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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

I don't even know how to formulate my question

Hello community,

 

I'm having difficulties formulating my problem in a form to find the answer so I'll try to explain what I need help with.

 

I the following table:

 

IdCategorySub-categorySub-sub-categoryCount
1AAAAAA1
2AABABA2
3BBABAA

1

 

This table is simplified and also contains +100 million rows.

 

I have two slicers for Sub-category and Sub-Sub-category. After I apply the slicers in the following configuration: Sub-category: AA and Sub-Sub-Category: AAA I want to be able to calculate the share AAA count accounts for of the Category A. In this case AAA 33%.

 

The only way I have been able to solve this is to duplicate the large table and create a relationship between Category columns. That way I can obtain the total count from secondary table. But due to the size of the table it is sluggish and heavy. Is there any way to solve this with a measure?

 

Thanks!

1 ACCEPTED SOLUTION
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You can try this measure:

% of category =
var subsubcategory = CALCULATE(SUM('Table'[Count]),ALLEXCEPT('Table','Table'[Sub-sub-category]))
var category = CALCULATE(SUM('Table'[Count]),ALLEXCEPT('Table','Table'[Category]))
Return
DIVIDE(subsubcategory,category,BLANK())
 
Result:
jppv20_0-1634283895802.png

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You can try this measure:

% of category =
var subsubcategory = CALCULATE(SUM('Table'[Count]),ALLEXCEPT('Table','Table'[Sub-sub-category]))
var category = CALCULATE(SUM('Table'[Count]),ALLEXCEPT('Table','Table'[Category]))
Return
DIVIDE(subsubcategory,category,BLANK())
 
Result:
jppv20_0-1634283895802.png

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

Anonymous
Not applicable

This did the trick. Thank you for the quick reply.

AllisonKennedy
Super User
Super User

@Anonymous  Do you have a star schema and Dim table for Product? The Dim table can contain Category, Sub-category and sub-subcategory, but should not contain the counts. 

 

https://excelwithallison.blogspot.com/2020/08/its-complicated-relationships-in-power.html 

 

Category Subtotal Sales =
CALCULATE(SUM(FactInternetSales[SalesAmount]), ALLEXCEPT(DimProduct, DimProduct[Category]))

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Yeah it is a star schema. The count column is a measure. I just wanted to simplify.

 

Thank you for the quick reply.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors