Configure function field to get date difference

pathumharsh
Tera Contributor

when I'm creating a report I had to get date difference between current date and table value. 

I used configure function field to do that, can anyone help me to do the calculation to get the value. 

u_access_last_verified is the table column

pathumharsh_0-1768387275223.png

 

7 REPLIES 7

Dr Atul G- LNG
Tera Patron

Hi @pathumharsh 

 

You need to use 2 date

 

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

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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]

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

Ankur Bawiskar
Tera Patron

@pathumharsh 

this is feasible but there is a challenge when you use now() there

I shared a workaround for this and it has a working solution

Function field to calculate Ageing in Report Designer 

sharing here again

blog below

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

As per the link I shared it says invalid syntax, but there is a workaround for that

AnkurBawiskar_2-1768388542590.png

 


 

 

It worked fine for me see below when I used that workaround

AnkurBawiskar_4-1768388579446.gif

 

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar ,

Can I get your help? I have a similar requirement for using a function in reports.

I have a string field where agent enters a number like 1, 5, 8, 50, 120..... anything

Now, I want to show Row Column report, where Row would be the state and column would be like

First Column(1-10) [Records having value from 1 to 10), Second Column(11-20) [Records having value from 11 to 20] and so on....


I have tried dividing the value by 10, and multiplying again. But, somehow it's not working.

Regards,
Najmuddin

@Najmuddin Mohd 

will have to check in PDI

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