Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
lucas3
Contributor III
Contributor III

Dates conditions I do not understand

Hello

I have a field named "WritingDate". I have two variables named "MaxDate" and "MinDate". The user is able to select these two variables as he wants so these two variables often move. Their purpose is to filter the writings in order to only show the ones that were entered between these 2 dates.

I have two problems about this, one with an "if condition", the other with a "sum" function

1) When I print the following formula : =if(([WritingDate]>=MinDate) AND ([WritingDate]<=MaxDate),1,0)
it sometimes does not print out the expected value. I noticed it depended on the selected dates: for some it works, for others it does not

2) When I print the following formula: 
    = -sum({(< [WritingDate]={"<=$(MaxDate)"}, [WritingDate]={">=$(MinDate)"} >)}Balance)
It does not take my conditions into consideration. It prints out the expected result if there was no condition (the sum of Balances)

Any clues please ?

Labels (1)
2 Replies
sidhiq91
Specialist II
Specialist II

@lucas3 May be you can try something like below for both the conditions:

1. if([WritingDate]>='$(MinDate)' and  [WritingDate]<='$(MaxDate)' ,1,0)

2.Sum({<[WritingDate]={">=$(MinDate)<=$(MaxDate)"}>}Balance)

lucas3
Contributor III
Contributor III
Author

Hello,

your solution works perfetcly for my if condition thanks !

but it does not for the sum 😞

other suggestions ?