Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I have this dataset, and need to calculate the subcategory weight over the category (not over the total).
So that the sum of the subcategories gives me 100%
When I am in Category row, I want to show the Category weight over total amount (p.e. 47% in Category 1) and when I am in subcategory row, I want to show the subcategory weight over the category amount.
For example:
Thank u very much
Solved! Go to Solution.
Hi,
Please check the below picture and tha attached pbix file.
It is for creating measures.
Percentage measure: =
VAR _categorytotal =
CALCULATE ( [Value total:], ALL ( Category[Subcategory] ) )
VAR _alltotal =
CALCULATE ( [Value total:], ALL () )
RETURN
SWITCH (
TRUE (),
ISINSCOPE ( Category[Subcategory] ), DIVIDE ( [Value total:], _categorytotal ),
ISINSCOPE ( Category[Category] ), DIVIDE ( _categorytotal, _alltotal ),
DIVIDE ( _categorytotal, _alltotal )
)
Hi,
Please check the below picture and tha attached pbix file.
It is for creating measures.
Percentage measure: =
VAR _categorytotal =
CALCULATE ( [Value total:], ALL ( Category[Subcategory] ) )
VAR _alltotal =
CALCULATE ( [Value total:], ALL () )
RETURN
SWITCH (
TRUE (),
ISINSCOPE ( Category[Subcategory] ), DIVIDE ( [Value total:], _categorytotal ),
ISINSCOPE ( Category[Category] ), DIVIDE ( _categorytotal, _alltotal ),
DIVIDE ( _categorytotal, _alltotal )
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 12 | |
| 10 | |
| 8 |