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

DISTINCTCOUNT when unfiltered

AndrewDavies437_0-1652887701114.png

Hello, 
I have a table (as above) where I am counting the distinct number of policies companywide. I also want to be able to filter by employee to show their distinct number of policies. 

 

Here is my problem:

If i filter by user A who has 5 distinct policies in January, then the table shows correctly as having 5 in Jan. 

If I filter by user B who also has 5 distinct policies in Jan then this also shows correctly. 

 

However, if i select both employees in my filter and they both have the same types of policies, the table will only show 5 in January. I would want the graph to show 10 as I am trying to count how many they both have combined. 

 

This means that when I do not filter by anyone, the numbers for distinct policies in Jan are grossly under what they should be as power bi is not summing the number of distinct policies the employees have. 

 

How can I get the table to show summed distinct policies when filtered by multiple people (or unfiltered as this would be all of the employees)?

 

I hope this makes sense, any help would be greatly appreciated.

Thanks

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@AndrewDavies437 

You can use SUMX over the list of employees to get the count you are looking for.  I don't know how your model is set up but this would be if you had a seperate table for Employees and one for Policies.

Employee Policy Count = 
SUMX ( VALUES ( Employees[Employee_ID] ), CALCULATE ( DISTINCTCOUNT ( Policies[Policy Number] ) ) )

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@AndrewDavies437 

You can use SUMX over the list of employees to get the count you are looking for.  I don't know how your model is set up but this would be if you had a seperate table for Employees and one for Policies.

Employee Policy Count = 
SUMX ( VALUES ( Employees[Employee_ID] ), CALCULATE ( DISTINCTCOUNT ( Policies[Policy Number] ) ) )

Thank you so much. I tried it, very quickly it was working. That's perfect thank you so much again. Have a great day 🙂 

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.