Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with if expression

My expression:

IF(Min(MONTHYEAR) > Min(MONTHYEAR2) and isnull(FIELD1),FIELD1B,if(Min(MONTHYEAR) > Min(MONTHYEAR2) and len(FIELD1)>0,FIELD1)) as Value

I need this:

1.-if(Min(MONTHYEAR) > Min(MONTHYEAR2) and isnull(FIELD1) output FIELD1B

2.-if(Min(MONTHYEAR) > Min(MONTHYEAR2) and isnotnull(FIELD1) output FIELD1

What I am doing wrong? Thanks!

3 Replies
Gysbert_Wassenaar

Looks ok to me. If you're using this expression in a load script then make sure to add every field that is not used in an aggregation function, like min(), to the Group By clause of that load.


talk is cheap, supply exceeds demand
sunny_talwar

May be this:

If(Min(MONTHYEAR) > Min(MONTHYEAR2), If(Len(Trim(FIELD1)) = 0, FIELD1B, FIELD1)) as Value

But note that you will get null when Min(MONTHYEAR) <= Min(MONTHYEAR2). If that's what you want then above should work for the two conditions you have give above.

Not applicable
Author

Hello!

I put it all the information here: Problem with if expression

thanks!