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: 
MrBosch
Creator
Creator

Count Unique (not distinct) - so count the numer of non-doubles

Hi

I am thinking about a solution for this one:

I have a great number of variables in a column. Let's say

ONE
ONE
ONE
TWO
THREE
THREE

What I need to count are the UNIQUE (single) variables. So COUNT DISTINCT would result in 3, COUNT gives me 6 but I want 1 as an answer since that is the only value that has an single occurence (="TWO").

Anyone you has an idea?

Thanks!

Labels (1)
3 Solutions

Accepted Solutions
Vegar
MVP
MVP

You could try something like this.

Sum(AGGR( Count(YourField)=1, YourField))

View solution in original post

sunny_talwar

How about this

Count({<FieldName = {"=Count(FieldName) = 1"}>} FieldName)

View solution in original post

Vegar
MVP
MVP

That's true
Count(YourField)=1 will return -1 if True
Just as a minus before the sum to get positive values.
-Sum(AGGR( Count(YourField)=1, YourField))

View solution in original post

5 Replies
Vegar
MVP
MVP

You could try something like this.

Sum(AGGR( Count(YourField)=1, YourField))
MrBosch
Creator
Creator
Author

Thank you so much. I do have a question though...

I do get all negative results. 😉   (I don't understand that...)

sunny_talwar

How about this

Count({<FieldName = {"=Count(FieldName) = 1"}>} FieldName)
Vegar
MVP
MVP

That's true
Count(YourField)=1 will return -1 if True
Just as a minus before the sum to get positive values.
-Sum(AGGR( Count(YourField)=1, YourField))
MrBosch
Creator
Creator
Author

Thanks guys. Highly appreciate your solutions! Keep up the good work!