Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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?

8 Replies
Anil_Babu_Samineni

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

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

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

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')