Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate date difference

Hi Community,i want to ask how can i calculate the date difference of today and the date of a set of data

I have tried to use DATE1-DATE2  but it's ineffective

For example =Floor(Interval(2017/7/19-last_stat_date,'DD'))

what function should i use?

Labels (1)
8 Replies
Anil_Babu_Samineni
MVP
MVP

May be this?

NetWorkDays(Today(), last_stat_date)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
passionate
Specialist
Specialist

Best way to handle date calulations like differences is using numeric date values:

Num(Date1)- Num(Date2)

MarcoWedel
MVP
MVP

Try enclosing your static date in single quotes and check your DateFormat variable to match this date.

Regards

Marco

Not applicable
Author

How can i obtain the date difference of today and a set of data with format like 6/18/2017 12:00:00 AM

Anil_Babu_Samineni
MVP
MVP

May be use

TimeStamp(DateField) - Now() as Days

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

It shows an expression error of the wording "as Days"

Kushal_Chawda
MVP
MVP

try below

  floor(Date1) - floor(Date1) as Days

mangalsk
Creator III
Creator III

For eg.  try below so that you can check exat value, replace  Date('7/24/2017 12:00:00 AM') with your required filed name

= Now()-Date('7/24/2017 12:00:00 AM')