Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

1 Solution

Accepted Solutions
sunny_talwar

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)

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
sunny_talwar

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)

Anonymous
Not applicable
Author

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