Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Nive
Partner - Contributor III
Partner - Contributor III

Count based on another count

Hi All,

I have a requirement where i need to show the count of Id's based on another count in table. PFB my sample data

 i have tried using valuelist in dimension and aggregation in measure.

IF( ValueList('1','2','>2')=1,if(Aggr(count(distinct ID),Name)=1,count(distinct Name)),if(Aggr(count(distinct ID),Name)=2,count(distinct Name)),if(Aggr(count(distinct ID),Name)>2,count(distinct Name)))))

getting null values. 

IDName
1aaa
2bbb
3ddd
4aaa
5ccc
6bbb
7aaa

 

Output needed:

count of ID'scount of Name
12
21
>21
Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Seems like you deleted your response... but try this

=Aggr(
	If(Count(ID) <= 5, Text(Count(ID)),
	If(Count(ID) < 11, '6-10', '>10'))
, Name)

View solution in original post

7 Replies
sunny_talwar

Try this

Dimension

Aggr(Count(ID), Name)

Expression

Count(DISTINCT Name)

 

sunny_talwar

To get the exact output, you can change your dimension to this

 

=Aggr(If(Count(ID) <= 2, Text(Count(ID)), '<2'), Name)

 

 

image.png

Nive
Partner - Contributor III
Partner - Contributor III
Author

yes, but i wanted the dimension names to be fixed. ( i want the count to be grouped as 1, 2,3, 4-10,>10)

sunny_talwar

Did you see my second response to your post?

sunny_talwar

Seems like you deleted your response... but try this

=Aggr(
	If(Count(ID) <= 5, Text(Count(ID)),
	If(Count(ID) < 11, '6-10', '>10'))
, Name)
Nive
Partner - Contributor III
Partner - Contributor III
Author

Yes worked it. got the output.. that's why deleted the last post.

Nive
Partner - Contributor III
Partner - Contributor III
Author

Thanks Sunny.