Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
i got a Question, i have tow datafields:
Field1 Field2
01.01.2019 06.01.2019
03.01.2019 not planned
04.01.2019 12.01.2019
i want compare two fields with each other, namely
if( Field1 < Field2, Field2,
if( Field1 > Field2, Field1,
if(Filed2 = 'not planned', Field1,'another case'))) as Controll,
but because of Filedvalue: not planned i am not able to compare These fields,
Does anybody know how to resolve this issue: if Field2 has the textvalue: 'not planned' then the Field1 should be taken.
Thanks a lot
Beck
Yes, that is correct. That is because it evaluates first if Field1 < Field2. This will not be correctly understood (in your way of thinking) by the Qlik Engine and give a false answer (for your wanted outcome). You should place it in front.
If your problem is solved, please mark this as solved.
Hi Beck,
Try this for example:
IF(Field2 = 'not planned', Field1, if(Field1 < Field2, Field2, Field1))
Kind regards,
Jordy
Climber
Hi Jordy,
thanks a lot for your responce and time, i have implemented and it does work, i have onle placed this Expression at in the first place in Expression, but i place this part of Expression in last place, then it does not work.
Do you have any idea how to define this behaviour within of Expression?
Hi Beck,
I'm not completely sure what you mean. Can you upload a screenshot of what you are trying to create?
Jordy
Climber
i mean this Situation:
if i use this Expression:
if(Field1 < Field2, Filed2
if(Field2 = 'not planned', Field1, 'another case'))) as you see i placed: if(Field2 = 'not planned', Field1, 'another case') on second place then it does not work
but if i placed it on first place like:
if(Field2 = 'not planned', Field1,
if(Field1 < Field2, Field2, 'not planned')) then it does work
If you don't want to change the order of your conditions you could also use: alt(Field2, 0) or maybe alt(Field2, addyears(today(), 100) to replace the string with a numeric default-value (it might be also useful to adjust this already within the script).
- Marcus
Hallo Marcus,
thanks a lot for your help and time
P.S: Vielen Dank
Yes, that is correct. That is because it evaluates first if Field1 < Field2. This will not be correctly understood (in your way of thinking) by the Qlik Engine and give a false answer (for your wanted outcome). You should place it in front.
If your problem is solved, please mark this as solved.
Thanks a lot for your time and help