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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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