Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Senor_Dai
Partner - Creator II
Partner - Creator II

Using Set Analysis and Date(Today()) ... help

Hi,

 

Im want to count count the number of customer within an app for the current day.... 

 

If I use 

=count({<Type={'Served'}, Date={'2021-10-29'}>}TypeTimestamp)  I correctly get 7

However, if I use 

count({<Type={'Served'}, Date={"$(=Date(Today(), 'YYYY-MM-DD'))"}>}TypeTimestamp)  I get 37.... 

Can anyone advise please?

Many thanks

Dai

Labels (1)
7 Replies
tresesco
MVP
MVP

Try like:

count({<Type={'Served'}, Date={'$(=Date(Today(), ''YYYY-MM-DD''))'}>}TypeTimestamp)

Note : highlighted in red are all single quotes. That means, use two singles quotes for formatting the date and put the final date in single quotes as well

Senor_Dai
Partner - Creator II
Partner - Creator II
Author

Hi Thanks for the reply.. 

This now returns 0 ... any ideas? 

My expression is now 

=count({<Type={'Served'}, Date={'$(=Date(Today(),''YYYY-MM-DD''))'}>}TypeTimestamp) 

Thanks

tresesco
MVP
MVP

What if you replace double quotes with square brackets, like below?

=count({<Type={'Served'}, Date={[$(=Date(Today(),'YYYY-MM-DD'))]}>}TypeTimestamp) 

Senor_Dai
Partner - Creator II
Partner - Creator II
Author

hi,  that gives me 37 again....

 

tresesco
MVP
MVP

That is what even I was expecting, i.e. - it should return the same value as set analysis with double quotes.  Okay, I guess this should work for your case:

count({<Type={'Served'}, Date={$(=chr(39)&Date(Today(),'YYYY-MM-DD')&chr(39))}>}TypeTimestamp) 

Note : no quotes outside $ expansion.

Senor_Dai
Partner - Creator II
Partner - Creator II
Author

Hi, thanks again for your help... This still gives 37.. 😐..

Could it be anything to do with the format of my Date field?

 

MarcoWedel

Could you please post a small sample application inlcuding only your Date field to test solutions with?

thanks

Marco