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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
brettgrubbs
Frequent Visitor

Sum of counts for each category with % total

I have tried many different suggestions from this forum allselected, allexcept, summarize as a new table and everything I just cannot figure this out. I need a total count for each provider to calculate the percent of each subcategory. I have the following table and if I can get it to work then I can put it on the visual to compare the % totals rather than counts. I have a page that can be filtered by year, month, and provider(s) . I need the total and % for each provider based on the selections in the filters. 

Here are the two measures as I have it now since this was the closest I have gotten. 

Here is a link to a greatly reduced excel file that shows on the first tab what I want to see and the 600 rows with what I think are the minimum columns need for this visual. The date column is linked to a date table and the provider ID is linked to a provider table but I just included the provider as a column to make it easier. The slicers on the below page are of course using the date and provider tables to filter.    

 

Total CPT Count by Provider = CALCULATE(Count(CPTsByEncounterAndClaim[Encounter ID]),ALLSELECTED(CPTsByEncounterAndClaim[Encounter ID]))

% Total CPT by Provider = DIVIDE(Count(CPTsByEncounterAndClaim[Encounter ID]),CPTsByEncounterAndClaim[Total CPT Count by Provider],0)

 

corrections shown in orange and redcorrections shown in orange and red

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@brettgrubbs , Change the total like

 

Total CPT Count by Provider = CALCULATE(Count(CPTsByEncounterAndClaim[Encounter ID]),Filter(ALLSELECTED(CPTsByEncounterAndClaim),CPTsByEncounterAndClaim[Provider] = max(,CPTsByEncounterAndClaim[Provider])))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@brettgrubbs , Change the total like

 

Total CPT Count by Provider = CALCULATE(Count(CPTsByEncounterAndClaim[Encounter ID]),Filter(ALLSELECTED(CPTsByEncounterAndClaim),CPTsByEncounterAndClaim[Provider] = max(,CPTsByEncounterAndClaim[Provider])))

Thanks, It works great but I don't quite follow the logic... basically you changed it to filter the "ALLSELECTED" CPTsByEncounterAndClaim table which should be 600 rows by the provider... but I don't understand how "MAX" works in this filter when I have more than one provider selected... wouldn't it just return "RRO"? 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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