Performance Analytics - Scripting in Formula Indicators

bhicks32
Giga Contributor

Hello,

I am experiencing issues when attempting to do IF/THEN scripting in formula indicators. Here is my current formula:

[[% of Alerts Handled Within TTR]] >= 0 ? 1 : 0

I am able to return the 1s. however I am still getting NULL values instead of 0 in the scorecard.  Essentially, I am attempting to create a new formula indicator off another existing formula indicator that inputs a 1 if there is data available and a 0 if there is NULL data. 

Any assistance here would be appreciated!

Thank you,

Ben

5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

 

Please use below example for if else in formula indicator scripting.

 

 

Structure:   <EVALUALTION> ? <OUTCOME IF TRUE> : <OUTCOME IF FALSE>

 

 

Example: Let's say I want to know the average length of time it takes to review implemented changes. One challenge, however, is that if the denominator of a formula is 0, it will calculate as a null value in the scores. A way to work around that is to include a condition in the formula. In this example, when the number of implemented changes = 0, I want the entire formula to evaluate to 0 instead of null.

 

[[Number of implemented changes]] == 0 ? 0 : [[Summed duration of change review period for implemented changes]] / [[Number of implemented changes]]

 

 

In the example, each item inside of the [[ ]] is a defined indicator. It could be an automated indicator, a manual indicator, or another formula indicator.

 

Regards,

Sachin

Adam Stout
ServiceNow Employee
ServiceNow Employee

By default, if ANY indicator in the formula is NULL, then the result is NULL.  As of Madrid, there is an option to allow NULLs (see the info here, look for "Allow formula component to be NULL").

Prior to London, you'll need to set a value for "Value when nil" on the automated indicator and then catch that in your formula.

bhicks32
Giga Contributor

I am in London instance and both of my automated indicators are set to "0" in the value when nil setting.  It appears when I collect the scores, the individual breakdowns I have selected for my indicators are not receiving the 0 value when it is nil.  Is there a workaround for this?

Adam Stout
ServiceNow Employee
ServiceNow Employee

And when you view the scorecard for [[% of Alerts Handled Within TTR]], there are no NULLs?