Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

A set analysis is calculated once per chart/table. NOT once per row

Can someone please explain what this means -

"A set analysis is calculated once per chart (or table). NOT once per row. If you want a different result in your set
analysis according to the row being calculated and displayed, it will NOT work. Change the way to compute your data
(model, if statement) but forget the set analysis." 

I am not able to understand what is being said here.

3 Replies
Not applicable
Author

bounce ! someone please help

sebastiandperei
Specialist
Specialist

To understand it, think in SA like selections that you made, not like values who depends on the dimmention values.

For example:

A table with Dimmention "Customer" and "Provider". If you want to sum "Sales" when the customer is the same than the provider (isn't useful, but it's only an example), you should do:

Sum (If Customer = Provider, Sales))

You CANT do this with SA, because Customer and Provider CHANGES in dimmentions.

But, if you want to get the sum of Customer = 'Qlikview', you could do:

Sum ({<Customer={Qlikview}>}Sales)

This will get you only Qlikview Sales, without the needing to make the "Qlikview" Customer Selection.

Excuse my English, was i clear?

Not applicable
Author

Here is an example to demonstrate this.

You have a simple inline table as shown below.

SET_AT_CHART:

LOAD * INLINE [

ID,CFlag,LFlag,Value

1,1,0,1

1,1,0,1

2,0,1,2

2,0,1,2

3,1,0,3

4,0,0,4

];

Now create a simple straight table with ID as the dimension and add the following expressions.

- SUM({<CFlag={1}>}Value)  (this will give you SUM of Value where CFlag = 1)

- SUM({<LFlag={1}>}Value)  (this will give you SUM of Value where LFlag = 1)

You cannot do this.  Here' the modifier uses the dimensional as a condition.  As SET is evaluated before the chart is expanded, the output will be 0 as this expression is not evaluated row by row.  As before the chart is expanded, the LFlag=CFlag cannot be correctly evaluated as there will be more than one possible values to these flags.

- SUM({<LFlag=CFlag>}Value)   // INCORRECT.

In this case if you need the correct output you can add the below expression, to evaluate at row by row basis.

IF (LFlag = CFlag, SUM(Value))

Please note, the above example of if is only for illustrative purpose, but you may have to evaluate your scenario to get the best solutions.

Here's the screen shot..

set-not-at-row.png

Hope this helps!