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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
OrthoData
Frequent Visitor

Percent of multiple subsets over time

Greetings, all!
I have a group of categories each with subcategories and totals for all. For example:

Category

SubcategoryCount of Events
1A###
1B###
1C###
2A###
2B###
2C###
3A###
3B###
3C###

 

I need to graph the percentage of SubCat A for each respective Category over time. All Categories must be represented on a single graph. Right now, I am creating a measure for every %A-of-Category combination but I'm looking for a more efficient and elegant solution. 

 

I tried doing the % of all A's for total all events, then using the Categories as the Legend, but I then get a rediculously small %.

 

Thank you all in adance!

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

Hi @OrthoData

 

You need a measure to calculate % of all A's for total all events as below:

 

 

Measure = 
DIVIDE(CALCULATE(SUM('Table'[Count of Events]),ALLEXCEPT('Table','Table'[Subcategory])),CALCULATE(SUM('Table'[Count of Events]),ALL('Table')))

 

 

And you will see:

Annotation 2020-02-03 105844.png

 

Then you need a measure to calculate the percentage of SubCat A for each respective Category as below :

 

 

Measure 2 = DIVIDE(CALCULATE(SUM('Table'[Count of Events]),ALLEXCEPT('Table','Table'[Category]),FILTER('Table','Table'[Subcategory]=SELECTEDVALUE('Table'[Subcategory]))),CALCULATE(SUM('Table'[Count of Events]),ALL('Table')))

 

And you will see:

 

Annotation 2020-02-03 110019.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @OrthoData

 

You need a measure to calculate % of all A's for total all events as below:

 

 

Measure = 
DIVIDE(CALCULATE(SUM('Table'[Count of Events]),ALLEXCEPT('Table','Table'[Subcategory])),CALCULATE(SUM('Table'[Count of Events]),ALL('Table')))

 

 

And you will see:

Annotation 2020-02-03 105844.png

 

Then you need a measure to calculate the percentage of SubCat A for each respective Category as below :

 

 

Measure 2 = DIVIDE(CALCULATE(SUM('Table'[Count of Events]),ALLEXCEPT('Table','Table'[Category]),FILTER('Table','Table'[Subcategory]=SELECTEDVALUE('Table'[Subcategory]))),CALCULATE(SUM('Table'[Count of Events]),ALL('Table')))

 

And you will see:

 

Annotation 2020-02-03 110019.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

 

This works. Thank you,

amitchandak
Super User
Super User

Try like

divide(Sum(Table[count of events]),calculate(Sum(Table[count of events]),all(table)))

divide(Sum(Table[count of events]),calculate(Sum(Table[count of events]),allexcept(table[caregory])))

 

Better than you take category out to a new dimesnion and then do

divide(Sum(Table[count of events]),calculate(Sum(Table[count of events]),all(Category)))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.