Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mikehildner
New Contributor III

Exclude selection when specifically included in set analysis

I'm experiencing some behavior I don't quite understand, and hoping someone could offer an explanation / solution.

Let's say I have this table:

TestInline:

Load * Inline [

  Group, Area, Quantity

    G1, A1, 3

    G1, A2, 5

    G2, A3, 8

    G2, A4, 13

];

I'm showing some numbers based on the group "G1" (8 in the below picture)

NoSelections.png

When I select Group "G2" I would expect that my expression would only include selected values, but instead it shows the quantity for "G1"

SelectedGroup.png

If I select just the Areas for G2, I get what I would expect to get when just G2 is selected

AreasSelected.png

I'm guessing that since my expression is explicitly specifying a Group, it's ignoring the "G2" selection in the second screenshot. Is that correct? Can anyone assist in getting the numbers I'm hoping to get?

Thank you,

Mike

Tags (2)
1 Solution

Accepted Solutions

Re: Exclude selection when specifically included in set analysis

When you have a field explicitly listed out in set analysis, it wouldn't change based on selection in that field, unless you have used Implicit Set Operators‌. In your case, try this

Sum({<Group *= {'G1'}>} Quantity)

3 Replies

Re: Exclude selection when specifically included in set analysis

Hi,

Both Statement is giving correct output. You must understand how set analysis works.

"Sum({$<Group = {"G1"}>}Quantity)"

This statement says that obey the current selection and over write the selection for Group. And thus when you make selection in Group field, it gets over written and you get value for G1 i.e 8

But when you make a selection in Area, the set analysis do not have area field and thus the group values cant not be over written and you get output as 0.

In your case if you want to have 0 as a result, I feel you should use the if statement then set anaysis.

Sum(if(Group = 'G1',Quantity,0)

Regards,

Kaushik Solanki

Re: Exclude selection when specifically included in set analysis

When you have a field explicitly listed out in set analysis, it wouldn't change based on selection in that field, unless you have used Implicit Set Operators‌. In your case, try this

Sum({<Group *= {'G1'}>} Quantity)

mikehildner
New Contributor III

Re: Exclude selection when specifically included in set analysis

Thank you for the replies. I think both ideas work, and was glad to get pointed to Implicit Set Operators.

Community Browser