Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF condition, checking number between two values

Hello everyone,

I am quite new in QlikView developing and I find a difficult to write an "If" statement. Now may statement is like

if(today() - "due_date" >='1' and today() - "due_date" <='30', "OpenAmount", '0') as [AR1-30]

But it has error. Can anyone suggest me how to write this sentence? I would like to check if today - due_date is in interval between 1 and 30 and if belongs to this I would like assign OpenAmount as [AR1-30]. Thank you in advance.

4 Replies
jsanchezh
Partner - Creator

Have you tried:

     if((today() - "due_date")>='1' and (today() - "due_date")<='30', "OpenAmount", '0') as [AR1-30]


Maybe it is because of the parenthesys missing and the expression wasn't ok


I hope it helps

Gysbert_Wassenaar
Partner - Champion III

There shouldn't be single quotes around the numbers.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi,

you can use Interval funciont:

if(interval(today()- due_date, 'd')>=1 and interval(today()- due_date, 'd')<=30, OpenAmount, 0) as Field

KR,

Elena

ger_alegria
Partner - Creator

Hello I guess you try to find if a date is between day 1 and day 30, so try with:

if(day(today()) - due_date >=1 and day(today()) - due_date <=30, OpenAmount, 0) as [AR1-30]


Let me Know if this help you