Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ninnartx
Creator
Creator

count distinct and set analysis

Hi everyone,

I'm having an issue with count distinct and set analysis.

Basically each customer has a target score and an actual score.

I want to know how many customers have actual >= target AND target>0

so my formula is

Count(Distinct {<Customer={"=sum(Actual)>=sum(Target)"}*{"=sum(Target)>0"}>}Customer)


It works fine if my dimension = Customer.
However, if my dimension = Product, then the count is wrong.

I feel like the set analysis is incorrect... perhaps an aggr somewhere?

I can't seem to figure it out...

I've attached a qvw below.

Any help would be greatly appreciated!!!

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Is this you are looking?

=Count({<Customer={"=(sum(Actual)>=sum(Target)) and (sum(Target)>0)"}>} DISTINCT Aggr(If((Sum(Actual) >= Sum(Target)) and Sum(Target)>0, Customer), Prod, Customer))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

6 Replies
Anil_Babu_Samineni

Is this you are looking?

=Count({<Customer={"=(sum(Actual)>=sum(Target)) and (sum(Target)>0)"}>} DISTINCT Aggr(If((Sum(Actual) >= Sum(Target)) and Sum(Target)>0, Customer), Prod, Customer))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be you need this when you view th e chart by Prod

=Count(DISTINCT If(Actual >= Target and Target > 0, Customer))

Chanty4u
MVP
MVP

try this

small change in sunny exp

=Count(If(Actual >= Target and Target > 0, DISTINCT  Customer))

sunny_talwar

I don't think DISTINCT can be used like you have used... I think mine was working just fine

ninnartx
Creator
Creator
Author

THANK YOU!!

ninnartx
Creator
Creator
Author

i got an error for both of the expressions above for some reason... but Anil's suggestion worked for me. Thank you so much anyway!