Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count days (today vs a date)

Hi,

I have ORDERDATE in the script (as YYYY-MM-DD). I want have a graph where I can see how many orders I have with 50-100 days between Today and Orderdate, how many with 100-200 days between Today and Orderdate and so on. I tried to count the days in the script, also using Interval, but didn't get it to work. What to do?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this?

If((Today() - ORDERDATE) >= 50 and (Today() - ORDERDATE) <= 100, Dual('50-100', 1),

If((Today() - ORDERDATE) >= 100 and (Today() - ORDERDATE) <= 200, Dual('100-200', 2)))

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

View solution in original post

3 Replies
Anil_Babu_Samineni

Perhaps this?

If((Today() - ORDERDATE) >= 50 and (Today() - ORDERDATE) <= 100, Dual('50-100', 1),

If((Today() - ORDERDATE) >= 100 and (Today() - ORDERDATE) <= 200, Dual('100-200', 2)))

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
luismadriz
Specialist
Specialist

Hi Mariana,

In addition you could also use a class function to create a new field. The only thing is that the groups are equally spaced in terms of the numbers of days,

LOAD *,

Class(Today()-ORDERDATE, 50, 'days') As OrderDays;

LOAD ... or the Order table

I hope this helps,

Cheers,

Luis

Anonymous
Not applicable
Author

Thank you!