Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
linoybar
Valued Contributor

Count distinct on a few subsets of data in expression

Hi,

I need to write an expression that counts distinct Order IDs but the expression contains a few data subsets, something like:

=Count({<some set analysis>}distinct Order ID)

+

Count({<some set analysis>}distinct Order ID)

+

Count({<some set analysis>}distinct Order ID)


Lets say the first expression returns 20 orders, the second one returns 10 orders and the third one returns 5 orders.

8 orders from the second expression are the same as in first one, so I need to count these 8 orders only once and not twice so at the end the result is supposed to be not 35 but 27.

1 Solution

Accepted Solutions
MVP
MVP

Re: Count distinct on a few subsets of data in expression

Maybe create a union of your sets:

=Count({<some set analysis>+<your second set>+<your third set>} distinct Order ID)

2 Replies
MVP
MVP

Re: Count distinct on a few subsets of data in expression

Maybe create a union of your sets:

=Count({<some set analysis>+<your second set>+<your third set>} distinct Order ID)

linoybar
Valued Contributor

Re: Count distinct on a few subsets of data in expression

Hi Stefan, thanks, interesting, I'll try that!