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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
LickNewin
Regular Visitor

Subtotal Divided by Row Value

I'm trying to create a measure which takes the value from each Row, and divides it by the Subtotal to give the Percentage of the Subtotal per row. 

 

I'm currently using this measure, but it just gives a value of 100% for each row, which is wrong.

Resignation Percentage = DIVIDE(COUNT(JoinedDataTable[Reason Code]),CALCULATE(COUNTROWS(JoinedDataTable)))

 
LickNewin_1-1714713473534.png

The below is what it should look like:

As an example, the '18-25' Age Bracket, should calculate as 22 / 204 = 0.1078 (10.78%)

Age BracketTotal%
Junior10.49
18-252210.78
26-30188.82
31-3573.43
36-4062.94
41-4583.92
46-5083.92
51-5573.43
56-6062.94
61-6583.92
66-70157.35
71-75209.80
76-802411.76
81-852713.24
86-90188.82
91-9552.45
96-9910.49
100+31.47
Total204100
1 ACCEPTED SOLUTION

Hi @LickNewin 

Just small change in formula
Try this 

Measure 2= 
var TotalCALCULATE(COUNT(Table[Reason code]),ALLEXCEPT(Table, Table[Reason code])

RETURN
Divide(Measure1,Total)
 
Uzi2019_0-1714716350265.png

 

It would give you expected output!
 
I hope i answered your question!
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

7 REPLIES 7
LickNewin
Regular Visitor

Here is the link to the PBIX file:

V3.pbix

Hi @LickNewin 

Just small change in formula
Try this 

Measure 2= 
var TotalCALCULATE(COUNT(Table[Reason code]),ALLEXCEPT(Table, Table[Reason code])

RETURN
Divide(Measure1,Total)
 
Uzi2019_0-1714716350265.png

 

It would give you expected output!
 
I hope i answered your question!
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hey Uzi,

It's coming up with an error that says the Syntax for RETURN is incorrect

LickNewin_0-1714716576965.png

 

I think i figured it out - it was missing a closing bracket after the ALLEXCEPT

Seems to be working now!!

 

Thanks for your help 🙂

hi @LickNewin 

you missed the closing bracket ) this one

Uzi2019_1-1714716767957.png

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Uzi2019
Super User
Super User

hi @LickNewin 
Try below dax for measure

 

Measure 1= Count ( Table[Reason code])

Measure 2= 
var Total= CALCULATE(COUNT(Table[Reason code]),ALL(Table))

RETURN
Divide(Measure1,Total)
 
you can see my output
Uzi2019_0-1714715086556.png

 

 

I hope I answered your question!

 

 


Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hey Uzi,

Unfortunately that doesn't work how I wanted.

It works fine when I have all the Reason codes selected in the Filter, but as soon as I filter it, the values are wrong.

 

LickNewin_0-1714715618569.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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