Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count orders that are 30 days old as of today?

Can anyone see why this returns nothing?

Count({<[reportdate]={">=$(=Date(Interval(TODAY() -30,'D'), 'MM/DD/YYYY') <=$(=(Today())"} >} [orders])

Thanks in advance

10 Replies
kamal_sanguri
Specialist
Specialist

One reason can be [reportdate] is not in date format.


daveamz
Partner - Creator III
Partner - Creator III

Hi Walter,

You don't need to use the interval function. You can use something like:

Count({<[reportdate]={">=$(=Date(TODAY()-30, 'MM/DD/YYYY')) <=$(=(Today())"} >} [orders])

If it doesn't work, try to remove the format of the date:

Count({<[reportdate]={">=$(=TODAY()-30) <=$(=(Today())"} >} [orders])

Regards,

David

Anonymous
Not applicable
Author

Man it still doesn't work returns empty

daveamz
Partner - Creator III
Partner - Creator III

Can you share a sample data set?

I need to check the date settings vs the date format of [report date].

daveamz
Partner - Creator III
Partner - Creator III

Have a look at the file attached file.

When I tried to use >=$(=Today()-30)  <=$(=Today()) it took only the lower limit because of the date format (the date is numeric). So I used:

>=$(=Today()-30)  <=$(=Today()-0) and now it's working.

David

Anonymous
Not applicable
Author

Still nothing, can i force the specific format

This first half works and returns a number: <=$(=Today())

the second kills it?

Anonymous
Not applicable
Author

if i update the following to the first half: <=$(=Today()-30)

it fails

Anonymous
Not applicable
Author

ok we got the first half working correctly now using this:

<=$(=date(Today()-30, 'MM/DD/YYYY'))

Now we need to get the second half of the equation to cooperate.:)

daveamz
Partner - Creator III
Partner - Creator III

Then you should force to the same date format as [reportdate]:

Count({<[reportdate]={">=$(=Date(TODAY()-30, 'MM/DD/YYYY')) <=$(=Date(Today(), 'MM/DD/YYYY'))"} >} [orders]