Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
We are aware of an issue with the Product Downloads page and looking into it.
cancel
Showing results for 
Search instead for 
Did you mean: 
FVenthakone
Partner - Contributor II
Partner - Contributor II

Set Analysis Count Excluded Problem

Hi,


I’ve been having some trouble with an expression using set analysis.

I have a list of distributors and their resellers for each YearWeek.

In a pivot table, when a distributor is selected, I need to count the exclusive Resellers of the selected Distributor. So with YearWeek as a dimension, I tried counting Reseller and then subtracting the ones in common with the excluded:


Count(DISTINCT Reseller) - Count({<Reseller= P({<Distributor=E(Distributor)>})>} DISTINCT Reseller)

However, this is not giving the correct count for each YearWeek. I only get the right count for a YearWeek when I select it.

Any thoughts?

Thanks

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Maybe along these lines:

=sum(aggr(if(count({<Distributor>} distinct Distributor)=1,1), YearWeek, Reseller))

View solution in original post

4 Replies
swuehl
Champion III
Champion III

Felix,

the set analysis will only be evaluated once per chart, it will not consider your dimension values.

Could you upload a small sample that demonstrate your issue and setup?

FVenthakone
Partner - Contributor II
Partner - Contributor II
Author

Hi swuehl,

Thanks for your reply. I've attached an example qvw.

When I select a Distributor e.g. Sweden, I want to get the count of resellers exclusive to Sweden. For W1-10, the count of exclusive resellers for Sweden is 58, but in the pivot table I get 10. I only get 58 when I select W1-10 as YearWeek.

Thanks

swuehl
Champion III
Champion III

Maybe along these lines:

=sum(aggr(if(count({<Distributor>} distinct Distributor)=1,1), YearWeek, Reseller))

FVenthakone
Partner - Contributor II
Partner - Contributor II
Author

Thanks swuehl, that's exactly what I wanted.