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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
emily-wise
Frequent Visitor

Distinct Count based on calculated percentage measure

I have a table with hundreds of thousands of rows for individual sales, but each sale is designated to a specific group. I have a slicer that selects the desired reporting period (end date) and then I can calculate the total sales for the rolling-12 months based on the selected date both for the national total and each group. Finally, I have created a measure that shows the percent contribution to the nation for each group during the selected time period (Group Sales %). This all works great. What I'm struggling with is getting a simple distinct count of the number of groups whose percent contribution (Group Sales %) is > 1%. See the screenshot below which shows the list of group sales percents, and the distinct count measure I've written. You can see that it's counting each group once, without being filtered by the measure. How can I change this measure to correctly count ONLY the groups where Group Sales % >= .01? The resulting card should show 19, not 92 (which is the count of ALL groups).

 

2024-03-14_18-44-14.png

 

 

1 ACCEPTED SOLUTION
emily-wise
Frequent Visitor

Thank you both! Due to this being filtered on a date slicer, I ended up having to force calculated columns for each month and then creating a measure based on the selected month and related percent. 

View solution in original post

3 REPLIES 3
emily-wise
Frequent Visitor

Thank you both! Due to this being filtered on a date slicer, I ended up having to force calculated columns for each month and then creating a measure based on the selected month and related percent. 

Anonymous
Not applicable

Hi @emily-wise ,

 

@Jihwan_Kim  provided a good solution. I have another method here, I hope it can be helpful to you.

1% Groups Count =
CALCULATE(
DISTINCTCOUNT('Sales Jan 23 to Present'[Dealer Group]),
FILTER(
SUMMARIZE('Sales Jan 23 to Present', 'Sales Jan 23 to Present'[Dealer Group], "GroupSalesPercent", [Group Sales %]),
[GroupSalesPercent] >= 0.01
)
)

SUMMARIZE Returns a summary table of the requested totals across a set of groups, creating a table containing each dealer group and its corresponding table. For detailed information, please refer to the document: SUMMARIZE function (DAX) - DAX | Microsoft Learn.

 

If the problem still exists, please provide a pbix file with representative data so that we can better help you solve the problem.

 

Best Regards,

Clara Gong

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

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but please try something like below whether it suits your requirement.

 

1% Groups Count: =
COUNTROWS (
    FILTER (
        VALUES ( 'Sales Jan 23 to Present'[Dealer Group] ),
        [Group Sales %] >= 0.01
    )
)


Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.