If statement in formula indicator

jasonedwards
Tera Contributor

I would like advice on how to write a formula indicator with an if statement.

The scenario is

If today is Monday, True would be sum incidents opened Friday, Saturday and Sunday / incidents opened on Thursday, False = sum of incidents opened yesterday / sum of incidents opened the day before yesterday.

I do not have the access to write scripts.

 

 

2 REPLIES 2

Varsha21
Giga Guru

Adam Stout
ServiceNow Employee
ServiceNow Employee

Here is a reference on using JavaScript in formulas:

https://community.servicenow.com/community?id=community_blog&sys_id=1f0d2ea5dbd0dbc01dcaf3231f961947

Only counting weekdays is challenging trying to look back in time.  I'm not sure how you would do it prior to Madrid, but in Madrid (with the addition of PAFormulaUtils, this is doable (but it will take some interesting JavaScript in the formula to get the day of the week).  Also, if you are a global company, remember to account for timezones.

https://docs.servicenow.com/bundle/madrid-performance-analytics-and-reporting/page/use/performance-a...