cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DA1981
Frequent Visitor

Coverage Calculation (Count / Count Distinct)

 

 

I am struggling to work out what I think should be some fairly straightforward DAX and can't find anything in the forum. Apologies if I have missed another post.

 

I have a client and product columns. What I am trying to achieve is to calculate what 'client coverage' each product has. Client coverage is defined by the percentage of clients that have a product and is between 0% and 100%. What is throwing a spanner in doing a COUNT(Products)/COUNT DISTINCT(Clients) is that some clients have some products more than once; the way I want my calculation to work is to be binary: A client has it or doesn't. I am not interested in how many times they have bought it.

Example data:

ClientProduct
A1
A2
A3
B1
B1
B2
C1

 

In this instance, all clients have product 1, but Client B has it twice. Therefore coverage should be 100% not 133% if I did the formula above.

 

Expected caluculated output:

 

ProductClient Coverage
1100%
267%
333%

 

Any help much appreciated. Thanks in advance.

1 REPLY 1
lbendlin
Super User III
Super User III

Here's a calculated column that you can use for that.

 

Coverage = DIVIDE(CALCULATE(DISTINCTCOUNT('Table'[Client]),ALLEXCEPT('Table','Table'[Product])),DISTINCTCOUNT('Table'[Client]))
 
Make sure to set its aggregation to "Don't summarize".
 
lbendlin_0-1628469783591.png

 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.