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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

comparisons in set analysis

Dear

I have an expression in which I want the following:

sum(if(ColA+ColB >5000) Amount)

this works fine but is there an alternative way to accomplish this using set analysis instead of if statement

Please advise

I can walk on water when it freezes
3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

A set analysis expression is only possible if you have a field that unique identifies the records.

sum({<KeyField={'=ColA+ColB>5000'}>}Amount)

ColA and ColB also need to be field names, not column labels. And if they are part of the same table then create a flag field in the script instead:


Load ColA, ColB, if(ColA+ColB>5000,1,0) as Flag

From mysource;


The expression can then become sum({<Flag={1}>}Amount)


talk is cheap, supply exceeds demand
jagan
Partner - Champion III
Partner - Champion III


Hi,

You can also the same in script and arrive a new flag dimension like this

LOAD

     *,

     if(ColA+ColB >5000, 1) AS Falg

FROM DataSource;

Now in the chart just use this

=Sum({<Falg = {1}>} Amount)

Hope this helps you.

Regards,

Jagan.

ali_hijazi
Partner - Master II
Partner - Master II
Author

is it necessary to have a key field or it works on any field? please explain via an example if possible and please clarify technical reasons

I can walk on water when it freezes