How to show average time of 2 variables (date type) of a Catalog Form in a Report?

AbdurRahmanSnow
Tera Guru

Good morning.!
We have a Catalog Item with 2 variables (date type) and we need to show the average time between them in a Report. How can we achieve this. Please help. These variables are present on the RITM.

AbdurRahmanSnow_0-1763531919030.png

Should we use PA scripts and then call it in an Indicator? If so, how to achieve and what are the other approaches? I tried PA scripts, but I don't know what should the "Facts table" be and how to select the 2 variables in the "Fields" field, as I cannot directly dot-walk.

AbdurRahmanSnow_1-1763532099378.png

@Ankur Bawiskar @Dr Atul G- LNG @Viraj Hudlikar 

3 ACCEPTED SOLUTIONS

Sarthak Kashyap
Mega Sage

Hi @AbdurRahmanSnow ,

 

Please check below links 

https://www.servicenow.com/community/grc-forum/how-to-calculate-difference-between-two-date-type-of-...

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

View solution in original post

Ankur Bawiskar
Tera Patron

@AbdurRahmanSnow 

you need to decide you want to have report or PA indicator.

Reporting is what I think you need.

Report on function fields 

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If the above doesn't work then create a hidden variable on your catalog item to store the difference or calculation and then use that in reporting

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Dr Atul G- LNG
Tera Patron

Hi @AbdurRahmanSnow 

 

You need to use the function in Reports where you can get the difference between these two dates.

 

https://www.servicenow.com/docs/bundle/zurich-now-intelligence/page/use/reporting/concept/function-f...

 

*************************************************************************************************************
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]

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

View solution in original post

5 REPLIES 5

Sarthak Kashyap
Mega Sage

Hi @AbdurRahmanSnow ,

 

Please check below links 

https://www.servicenow.com/community/grc-forum/how-to-calculate-difference-between-two-date-type-of-...

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

Ankur Bawiskar
Tera Patron

@AbdurRahmanSnow 

you need to decide you want to have report or PA indicator.

Reporting is what I think you need.

Report on function fields 

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If the above doesn't work then create a hidden variable on your catalog item to store the difference or calculation and then use that in reporting

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@AbdurRahmanSnow 

Thank you for marking my response as helpful.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 
Thank you so much for your valuable reply. PA scripts did not work since, those should be callable fields... Tried everything with different tables, but nothing worked.

That's why, I went with your 2nd approach to create a hidden variable on the Form and call it on the report. I took the average using Business rule for calculating average, since client scripts did not work.

Thanks a lot.