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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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