Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
vlad_komarov
Partner - Specialist III
Partner - Specialist III

Comparing dates in Set Analysis

Hello,
I have two dates in my table: [Current Service Date] and [Initial Service Date]. I need to display totals based on these dates comparison:
I thought this should work:
Sum ({< [Current Service Date] = {'>=([Initial Service Date])'} >} [Quantity])
But it does not.
Both Date fields above are numeric. Any suggestions what I am  missing here?
Best regards,
Vladimir
4 Replies
swuehl
MVP
MVP

Vladimir,

do you have field with unique values like created using recno() ?

Then try this

sum( {< [RecID] = {"=[Current Service Date]>=[Initial Service Date]"} >} [Quantity] )

Note that I used a search expression using double quotes, not single quotes.

Hope this helps,

Stefan

erichshiino
Partner - Master
Partner - Master

HI,

Vladimir

You can also create a flag on script for this task:

Load [Current Service Date], [Initial Service Date] ,

...

if(  [Current Service Date] >=[Initial Service Date] , 1, 0 ) as DateFlag

...

From...

Then, on your chart, the set analysis expression will be:

Sum ({<DateFlag={1} >} [Quantity])

Hope this helps,

Erich

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Thanks Stefan,

Your suggestion works better than mine (:-)), but I've noticed that I cannot use '<=' check there..Is it because its similarity with Set Analysis syntax? I am going to check my data as well since it might contribute to the latest problem.

But thanks for a hint to the right direction.

Regards,

Vladimir

swuehl
MVP
MVP

Vladimir,

are you saying, that

=sum( {< [RecID] = {"=[Current Service Date]>=[Initial Service Date]"} >} [Quantity] )

does work ok, but

=sum( {< [RecID] = {"=[Current Service Date]<=[Initial Service Date]"} >} [Quantity] )

does not?