Reporting fix

pramn
Kilo Sage

Hi Team , 

I have created Compliance report based on review date , which is working fine .

now user come back and asked me to have this 

1.Compliance--> Compliance/Total (Compliance+Non-Compliance)

2.Non-Compliance--> Non-Compliance/Total (Compliance+Non-Compliance)

how do i achive this ?

current report is like 

compliance 

pramn_0-1768298991152.png

 

non compliance 

pramn_1-1768299029229.png

 

4 REPLIES 4

Dr Atul G- LNG
Tera Patron

It looks like there is no direct way. A compliance record is only after 11 months, and anything before 11 months is non compliance, which means we are suing all data. Try using the function field to handle this

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

do we have function field in data visualization ? i mean i dint find out ...let me know if we have ..i can try this 

Hi @pramn 

 

No.As stated in the documentation, you cannot create function fields in Platform Analytics. You have to navigate back into Report Designer. Sorry, we have finite resources. However, you can use function fields in Platform Analytics data visualizations just as you would in Reports.

 

DrAtulGLNG_0-1768305293376.png

 

 

Try @vaishali231  inputs

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

vaishali231
Tera Guru


Hi @pramn 


I already have a Compliance report based on Review Date and Active = true, and the current filter logic is working correctly.

Now the business has asked for the following additional metrics instead of just counts:

• Compliance Ratio = Compliance / (Compliance + Non-Compliance)
• Non-Compliance Ratio = Non-Compliance / (Compliance + Non-Compliance)

After reviewing the reporting options, this cannot be achieved using a single out-of-the-box report because ServiceNow reports do not support cross-condition ratio calculations.

Below are the approaches that work.

Option 1: Performance Analytics 

If these metrics are needed on dashboards or over time, Performance Analytics is the right solution.

Create three indicators:
• Compliance Count
• Non-Compliance Count
• Total Count

Then create two derived indicators:
• Compliance Percentage = Compliance Count / Total Count
• Non-Compliance Percentage = Non-Compliance Count / Total Count

This gives clean percentages and supports trending and historical data.

Option 2: Single Report + Grouping 

Create one report with:
• Active = true

Group by a condition such as:
• Review Date after javascript:gs.monthsAgo(11) → Compliance
• Else → Non-Compliance

This will give counts for both in the same report.
However, the ratio calculation must be done outside the report (dashboard widget, scripted metric, or manual calculation).

Option 3: Scripted Metric or Database View

If the logic needs to be reused across multiple reports:
• Create a scripted metric that calculates totals and ratios
or
• Use a database view to classify records as Compliance or Non-Compliance

This works well when reporting requirements become more complex.

*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.

Regards
Vaishali Singh