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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gambleave
Helper II
Helper II

Counting Distinct Combinations

Hi All, 

For a scenario of consultants at a business providing service to clients, I have the following simple measures to count the number of distinct clients (individuals at companies) to receive high touch service within a time period, as well as the number of distinct consultants providing high touch service during the period. I use this in a matrix with companies in rows and months as columns.  

 

Distinct Clients High Touch = 
CALCULATE(DISTINCTCOUNT(ServiceHistory[Client Name]), ServiceHistory[Service Type]=“High Touch”)
 
Distinct Consultants High Touch =
CALCULATE(DISTINCTCOUNT(ServiceHistory[Employee Name]), ServiceHistory[Service Type]=“High Touch”)

 

I want to create a measure to count the total across variations of consultants/clients (e.g. if consultant #1 services 4 clients, consultant #2 services 6 clients, consultant #3 services 5 clients, the total would be 15 at that company). I tried the following measure, but the values are too high. What have I got wrong? 


ConsultantClient Combinations =
SUMX(SUMMARIZE(ServiceHistory, ServiceHistory[Client Name], ServiceHistory[Employee Name]), CALCULATE(DISTINCTCOUNT(ServiceHistory[Activity ID]), ServiceHistory[Service Type]=“High Touch”))

 

Activity ID here is a unique identifier for interactions (although there could be duplication, e.g. if a consultant meets with 3 clients as a group, there would be three records with the same Activity ID). 

 

Thank you!

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @gambleave ,

 

I have created a data sample for test.

Eyelyn9_0-1656555260158.png

 

Could you please tell me what's your expected output? Refer to:

How to Get Your Question Answered Quickly - Microsoft Power BI Community

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Measure 1 = DISTINCTCOUNT(ServiceHistory[Activity ID])

Measure 2 = SUMX(FILTER(SUMMARIZE(generate(values(ServiceHistory[Client Name]),values(ServiceHistory[Employee Name])), ServiceHistory[Client Name], ServiceHistory[Employee Name]),"ABCD",[Measure 1]),ServiceHistory[Service Type]="High Touch"),[ABCD])

If this does not work, then share the link from where i can download your PBI file and show the expected resutl very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much for your help Ashish!

v-eqin-msft
Community Support
Community Support

Hi @gambleave ,

 

I have created a data sample for test.

Eyelyn9_0-1656555260158.png

 

Could you please tell me what's your expected output? Refer to:

How to Get Your Question Answered Quickly - Microsoft Power BI Community

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.