Using an If Formula in a Formula Indicator - SYNTAX Assistance needed

jstoessel
Tera Guru

I am working on an incident measure of "Percent Change of MTTR year over year" - with a breakdown by Business Service.

The basic formula is:

  • ((MTTR This Fiscal Year-MTTR Last Fiscal Year)/MTTR Last Fiscal Year)*100

When both years have incidents closed - no problem. 

However, some Business Services are new This Fiscal Year, to Last Fiscal Year is a zero.

In a spreadsheet, I would use this to overcome the issue of the 0 value for Last Fiscal Year

jstoessel_0-1734725340876.png

 

When I attempt this using what I can find in Docs.ServiceNow.Com  I believe it is telling me this should be my format:

jstoessel_1-1734725460926.png

This is my error on SAVE:

jstoessel_2-1734725538161.png

When I replace the 

    else { 9 } with single digit - it saves and populates either the 1 or 9 , 

but instead of the 1, I need the equation to run.

 

I know I'm overcomplicating this - so I hope someone will just kickstart me into the right solution.  Thanks!

 

 

2 ACCEPTED SOLUTIONS

jeffrubinoff
ServiceNow Employee
ServiceNow Employee

To the best of my knowledge, you cannot use logical operators like "if...else" in an indicator formula, only arithmetic operators like +,-,x,/, along with predefined time series aggregations and PAFormulaUtils methods.

View solution in original post

AndersBGS
Tera Patron
Tera Patron

Hi @jstoessel ,

 

 you can’t use logic scripting in the formula indicator. instead you should state your logic in a scripted automated indicator for the data collection.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

 Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

2 REPLIES 2

jeffrubinoff
ServiceNow Employee
ServiceNow Employee

To the best of my knowledge, you cannot use logical operators like "if...else" in an indicator formula, only arithmetic operators like +,-,x,/, along with predefined time series aggregations and PAFormulaUtils methods.

AndersBGS
Tera Patron
Tera Patron

Hi @jstoessel ,

 

 you can’t use logic scripting in the formula indicator. instead you should state your logic in a scripted automated indicator for the data collection.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

 Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/