cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper II

## Percentage of Subtotal in Matrix visualizations

I need to make a matrix visualizations that show the percentage of subtotal as below

Course_Site (On Campus, High Flex, Off Campus)

Columns: College

Values: % of subtotal (for example: 82% of undergraduate course sections are on campus)

I created a new variable using the formula:

But when I placed the variable "ModalityPerc" for values, I got this error

Any idea on how I should modify the formula to make it work? Thanks.

1 ACCEPTED SOLUTION
Responsive Resident

Ah ok, you would need to add the school into the ALLEXCEPT too

`Section_Total =CALCULATE (SUM ( Aggr_Headcount[Section_Count] ),ALLEXCEPT ( Aggr_Headcount, Aggr_Headcount[Course_LEVEL],Aggr_Headcount[School]  ))`

So anything you want the measure to continue to be filtered by, such as the level or school goes in the second part of that except.

You could then use that in your % calc

`ModalityPerc =DIVIDE ( SUM ( Aggr_Headcount[Section_Count] ), [Section_Total] )`

5 REPLIES 5
Responsive Resident

The reason you're getting this error is because of the part highlighted in red below. The second part of a CALCULATE should be some kind of filter which would return a true/false, for example Aggr_Headcount[Course_LEVEL] > 10

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helper II

I try to make the formula dynamic, so it will calculate the % of subtotal for each category of course level

Responsive Resident

Try this

`Section_Total =CALCULATE (SUM ( Aggr_Headcount[Section_Count] ),ALLEXCEPT ( Aggr_Headcount, Aggr_Headcount[Course_LEVEL] ))`

This would give you the bottom number of your divide

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Matt

Helper II

Thank you. I tried your formula, but it returns the same value as shown below?

Responsive Resident

Ah ok, you would need to add the school into the ALLEXCEPT too

`Section_Total =CALCULATE (SUM ( Aggr_Headcount[Section_Count] ),ALLEXCEPT ( Aggr_Headcount, Aggr_Headcount[Course_LEVEL],Aggr_Headcount[School]  ))`

So anything you want the measure to continue to be filtered by, such as the level or school goes in the second part of that except.

You could then use that in your % calc

`ModalityPerc =DIVIDE ( SUM ( Aggr_Headcount[Section_Count] ), [Section_Total] )`

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors