Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
tevauserwxc
New Contributor

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

Tags (1)
10 Replies
kamal_sanguri
Valued Contributor

Re: Count orders that are 30 days old as of today?

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


daveamz01
Contributor III

Re: Count orders that are 30 days old as of today?

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

tevauserwxc
New Contributor

Re: Count orders that are 30 days old as of today?

Man it still doesn't work returns empty

daveamz01
Contributor III

Re: Count orders that are 30 days old as of today?

Can you share a sample data set?

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

daveamz01
Contributor III

Re: Count orders that are 30 days old as of today?

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

tevauserwxc
New Contributor

Re: Count orders that are 30 days old as of today?

Still nothing, can i force the specific format

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

the second kills it?

tevauserwxc
New Contributor

Re: Count orders that are 30 days old as of today?

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

it fails

tevauserwxc
New Contributor

Re: Count orders that are 30 days old as of today?

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.Smiley Happy

daveamz01
Contributor III

Re: Count orders that are 30 days old as of today?

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]