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: 
veldetta
Contributor III
Contributor III

Set analysis - Show all but only those from selected field

I have this set analysis:

sum({1<FLAG={1} ,Type={'Individual'}>} Aggr(max({1}SALES),ID))
/
count(distinct {1<Status={'Active'},Type={'Individual'},FLAG={1}>}ID)

However, when I select a selection from Peer Group, I only want those IDs within that Peer Group to show.

The Peer Group has 3 selections:

  • Top 100
  • Top 101-201
  • Top 201-500

For example, by default, all 500 items are showing but if I select 'Top 100', then I only want the Top 100 to show.  I've done some browsing and playing around with it but I'm stuck, how would I modify my Set Analysis to do this?

1 Solution

Accepted Solutions
Vegar
MVP
MVP

What about using implicit set analysis. P() like this.


sum({1<[Peer Group]=P([Peer Group]), FLAG={1} ,Type={'Individual'}>} Aggr(max({1<[Peer Group]=P([Peer Group])>}SALES),ID))

/
count(distinct {1<[Peer Group]=P([Peer Group]),Status={'Active'},Type={'Individual'},FLAG={1}>}ID)

View solution in original post

5 Replies
Vegar
MVP
MVP

If you want selections to make an impact to your expression, then you might consider to limit your set from {1} to {$}. Like this:

sum({$<FLAG={1} ,Type={'Individual'}>} Aggr(max({1}SALES),ID))
/
count(distinct {$<Status={'Active'},Type={'Individual'},FLAG={1}>}ID)

Alternatively you can try to add an modifier to just that field.

sum({1<[Peer Group]*={*},FLAG={1} ,Type={'Individual'}>} Aggr(max({1}SALES),ID))
/
count(distinct {1<[Peer Group]*={*},Status={'Active'},Type={'Individual'},FLAG={1}>}ID)

veldetta
Contributor III
Contributor III
Author

I want the expression to take into account the Peer selection but ignore everything else which is why the 1st option is not working for me, and the second one doesn't work like i would expect.

Vegar
MVP
MVP

What about using implicit set analysis. P() like this.


sum({1<[Peer Group]=P([Peer Group]), FLAG={1} ,Type={'Individual'}>} Aggr(max({1<[Peer Group]=P([Peer Group])>}SALES),ID))

/
count(distinct {1<[Peer Group]=P([Peer Group]),Status={'Active'},Type={'Individual'},FLAG={1}>}ID)

veldetta
Contributor III
Contributor III
Author

You're a lifesaver!  That worked.  Thank you!

Vegar
MVP
MVP

Thank you for the kind words.  I am glad it worked out for you. 

-Vegar