Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts
I have a problem with IF Statements in the script. The bolder IF is not working. The italic IF is working fine.
Any ideas why the second IF is not working?
if(WILDMATCH("Status", 'Closed'),
//the following 2 lines are working
IF(date(Monthstart(Timestamp)) = date(Monthstart([Termination Date]))
and date(MonthEnd(Timestamp))>date(([Termination Date])),1,
// the next IF is not working
if(date(MonthEnd([Closing Day])) = date(([Closing Day])) and
date(Addmonths(MonthStart([Closing Day]),1), 'YYYY-MMM')=date(MonthStart(Timestamp),'YYYY- MMM'),1
)))
As Target,
If your fields are dates and timestamps you don't need to format them for a comparison. It's the opposite of helpful because it will cover the values behind it. Better would be to apply a num() or maybe a multiplication of 1 to enforce pure numeric value-views.
I assume that if you load all those fields in this way separately and pulling them into a table-box by enabling at least 6 - 9 digits you will see that the values aren't so identically as you expects them because some these fields are probably timestamps and also the applied monthend/monthstarts/addmonths will return timestamps. Because of the fact that Qlik used a binary number-system there is not always an exact decimal value which becomes critical by checks against equally.
If so you may apply a rounding like floor() to remove the time-parts and/or changing the comparison to something like:
sign(Date1 - Date2) as Flag1
and later you may just query the flag-values or applying them into range-functions or multiplying them.
If your fields are dates and timestamps you don't need to format them for a comparison. It's the opposite of helpful because it will cover the values behind it. Better would be to apply a num() or maybe a multiplication of 1 to enforce pure numeric value-views.
I assume that if you load all those fields in this way separately and pulling them into a table-box by enabling at least 6 - 9 digits you will see that the values aren't so identically as you expects them because some these fields are probably timestamps and also the applied monthend/monthstarts/addmonths will return timestamps. Because of the fact that Qlik used a binary number-system there is not always an exact decimal value which becomes critical by checks against equally.
If so you may apply a rounding like floor() to remove the time-parts and/or changing the comparison to something like:
sign(Date1 - Date2) as Flag1
and later you may just query the flag-values or applying them into range-functions or multiplying them.