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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
NarMcAndrew
Contributor
Contributor

Accumulated Distinct Count

Hi everyone!

I've got a problem with counting distinct IDs (with 2 conditions) monthly and in accumulation.

Here is my table:

shot1.png

I want to get unique count of IDs with both flags = 1 for each month, but without repeating in future months. I mean, I need get, for example, 31 IDs in Jan 2019 and 204 IDs in Feb 2019 - so unique IDs of Feb 2019 don't include any unique IDs in Jan 2019.

So, currently I use two formulas for calculating unique IDs for every month (2nd column) and accumulate them (3rd column) - but I need to get 31 for Jan 2019, 204 for Feb 2019 (instead of 215 - which include some unique IDs from Jan), 221 in Mar 2019 (instead of 219 - which include some unique IDs from Jan and Feb) and so on. My incorrect results are in table below:

shot2.png

I attach a little another example for better understanding. Of course, I need here accumulation, too , so Jan -2, Feb - 4, Mar - 4 (only IDs with flag=1):

NarMcAndrew_0-1588765830003.jpeg

I want a solution in set analysis, without any AsOfTable because it's quite difficult to implement in my data model.

Lookin forward to get any help.

Labels (1)
1 Reply
NarMcAndrew
Contributor
Contributor
Author

instead of 291 in Mar*