Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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.

4 Replies
swuehl
MVP
MVP

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