Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sai_12
Contributor III
Contributor III

counting per group

Hello everyone,

I have a table which is of format

customer_id company cat
1 amazon furniture
1 amazon technology
2 amazon furniture
3 google airpods
3 amazon technology
4 amazon clothes
4 amazon watch
5 ikea furniture

 

I am trying to calculate a meausre 

count customer id who have more than 2 differnt cat from amazon / total customers who bought on amazon

 

1 amazon furniture
1 amazon technology
2 amazon furniture
3 amazon technology
4 amazon clothes
4 amazon watch

 

output:2/4

how can this be achieved front end

My measure at the moment if((aggr(count({<company={'amazon'}>}distinct cat),customer_id)>2),1,0)

Labels (4)
1 Reply
MayilVahanan

Hi

Try like below

=Count({<customer_id ={"=Count({<company = {'amazon'}>} cat)>=2"}>} DISTINCT customer_id) / Count({<company = {'amazon'}>}DISTINCT customer_id)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.