Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Set analysis

Hi all,

I was eager to know whether can we write a set analysis statement for the below If statement:

Aggr(If(Len(Trim(Amount))>0, Amount, Profit), ID).


I have 3 columns, ID, Amount and profit.

But for few IDs the "Amount" field is empty and hence i wanna fetch the profit field whenever i encounter a null in "Amount".


Can someone pls help here.

Labels (1)
4 Replies
swuehl
Champion III
Champion III

Since you want to return either Amount or Profit field value, I believe there is no way around a conditional function. But I would consider doing this stuff in the load script, not in the front end, by creating a new field:

LOAD

     ID,

     Profit,

     Amount,

     if(Len(Trim(Amount))>0, Amount, Profit) as Value,

     ...

FROM ...;

mvaugusto
Creator
Creator

Yes you can!

Aggr(If(Len(Trim(Amount))>0, Amount, Profit), ID)

Thanks

markgraham123
Specialist
Specialist
Author

Thanq

markgraham123
Specialist
Specialist
Author

Thanq