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

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date comparision with variable

Dear All,

I defined variable as ANALYSIS_DATE type date; I have field as TDate; I want to sum AMOUNT which is below the ANALYSIS_DATE;

My expression: =sum(all (if(TDate < max(ANALYSIS_DATE), AMOUNT)) is not working; please guide me.

Thanks

Eshack

4 Replies
Not applicable
Author

can you try this

=If(TDate < max(Analysis_date), sum(Amount))

-Raghu.

Not applicable
Author

Hi,

Try out this below expression

=sum(all (if(TDate < max(total ANALYSIS_DATE), AMOUNT))

- Sridhar

Anonymous
Not applicable
Author

Eshack,
If the ANALYSIS_DATE is a variable, I don't understand the need of max(). So, this should be enough
=sum(all (if(TDate < ANALYSIS_DATE, AMOUNT))
Make sure that the format of Date and ANALYSIS_DATE are both date or number.
(I don't see the need of "all" qualifier in this case, but hope you know what you're doing.)

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I found Date comparizon quite tricky, because of the dual nature of Dates. I'm usually casting them to numerics, just to make sure that I'm comparing the same values:

if( num(Date1) = num(Date2) ...

Oleg

Ask me about Qlik Sense Expert Class!