Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

marianagronroos
New Contributor II

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

Re: Count days (today vs a date)

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

3 Replies

Re: Count days (today vs a date)

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

luismadriz
Valued Contributor

Re: Count days (today vs a date)

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

marianagronroos
New Contributor II

Re: Count days (today vs a date)

Thank you!