Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set analysis vs if

Hello community

lately I discovered the set analysis features for me and they seam to be quite helpful

I'm struggeling a bit with the understanding and the cases when to use what. Maybe you can help.

For getting results for "where" conditions I was using before:

If(DimColor='green',Count(Field1),0)

or Count(If(DimColor='green',Field1,0)

For getting cumulated sums or counts I was using

Count(Total <Dim1, Dim2> Field1) or aggr()

And all of it was quite tricky and also depending whether the datamodel was one table or several rational connected tables.

Additionally sometimes I needed to ajust the datamodel so I could make it work using the above mentioned methods.

With set analysis it seems so easy to get the things work.

So coming back to the question what are the differences of the methods and where should I use what?

Could you give me a quick guideline.

Thank you so much in advance

//chesterluck

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Set analysis is like a selection, that is evaluated before the chart is built. I.e. it cannot be be evaluated row-by-row.

See more on A Primer on Set Analysis, Conditional Aggregations

HIC

View solution in original post

3 Replies
hic
Former Employee
Former Employee

Set analysis is like a selection, that is evaluated before the chart is built. I.e. it cannot be be evaluated row-by-row.

See more on A Primer on Set Analysis, Conditional Aggregations

HIC

Anonymous
Not applicable
Author

Ok but in case I have all the values from my datamodel and I dont want the sums and count to ajust after post selections (but really want to cumulate dimensions of my datamodel) then there is nothing wrong in using set analysis.

Or am I wrong?

hic
Former Employee
Former Employee

If you don't want the selections to affect the sums and counts, all you need to do is to use 1 as set definition instead of $, e.g.

   Count({$<DimColor={'green'}>} Field1)

   Count({1<DimColor={'green'}>} Field1)


The top one will respect the selections, and the bottom one will not.


HIC