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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Chandrashekar
Resolver III
Resolver III

Dax : % of row total

Hello,

 

How to write DAX to get % of Row total for below table.

Expected result is % of row total(Ach) & % of row total(Bre)

PriAchBre% of row total(Ach)% of row total(Bre)Dax(% of row total(Ach)Dax(% of row total(Bre)
S184198.82%1.18%  
S2457299.56%0.44%  
S3975299.80%0.20%  
S44 100.00%0.00%  
S52 100.00%0.00%  
Total1522599.67%0.33%  

 

Regards,

Chandrashekar B

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Chandrashekar ,

Please try to create measure with below dax formula:

% of row total(Ach) =
VAR _ach =
    SELECTEDVALUE ( 'Table'[Ach] )
VAR _bre =
    SELECTEDVALUE ( 'Table'[Bre] )
VAR _val =
    DIVIDE ( _ach, _ach + _bre )
VAR _a =
    SUMX ( ALL ( 'Table' ), [Ach] )
VAR _b =
    SUMX ( ALL ( 'Table' ), [Bre] )
VAR _val1 =
    DIVIDE ( _a, _a + _b )
RETURN
    IF ( HASONEVALUE ( 'Table'[Pri] ), _val, _val1 )
% of row total(Bre) =
VAR _ach =
    SELECTEDVALUE ( 'Table'[Ach] )
VAR _bre =
    SELECTEDVALUE ( 'Table'[Bre] )
VAR _val =
    DIVIDE ( _bre, _ach + _bre )
VAR _a =
    SUMX ( ALL ( 'Table' ), [Ach] )
VAR _b =
    SUMX ( ALL ( 'Table' ), [Bre] )
VAR _val1 =
    DIVIDE ( _b, _a + _b )
RETURN
    IF ( HASONEVALUE ( 'Table'[Pri] ), _val, _val1 )

vbinbinyumsft_0-1681797636988.png

Please refer the attaced .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Chandrashekar ,

Please try to create measure with below dax formula:

% of row total(Ach) =
VAR _ach =
    SELECTEDVALUE ( 'Table'[Ach] )
VAR _bre =
    SELECTEDVALUE ( 'Table'[Bre] )
VAR _val =
    DIVIDE ( _ach, _ach + _bre )
VAR _a =
    SUMX ( ALL ( 'Table' ), [Ach] )
VAR _b =
    SUMX ( ALL ( 'Table' ), [Bre] )
VAR _val1 =
    DIVIDE ( _a, _a + _b )
RETURN
    IF ( HASONEVALUE ( 'Table'[Pri] ), _val, _val1 )
% of row total(Bre) =
VAR _ach =
    SELECTEDVALUE ( 'Table'[Ach] )
VAR _bre =
    SELECTEDVALUE ( 'Table'[Bre] )
VAR _val =
    DIVIDE ( _bre, _ach + _bre )
VAR _a =
    SUMX ( ALL ( 'Table' ), [Ach] )
VAR _b =
    SUMX ( ALL ( 'Table' ), [Bre] )
VAR _val1 =
    DIVIDE ( _b, _a + _b )
RETURN
    IF ( HASONEVALUE ( 'Table'[Pri] ), _val, _val1 )

vbinbinyumsft_0-1681797636988.png

Please refer the attaced .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

Thank you & will try this.

 

Regards,

Chandrashekar B

 

amitchandak
Super User
Super User

@Chandrashekar , Usually we do it like

Assume Ach is measure

% of total =

Divide([Ach], calculate([Ach], allselected()) )

 

% of row total =

Divide([Ach], calculate([Ach], removefilters(Table[Pri]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello Amit,

Ach is not a measure it is direct value.

Regards,

Chandrashekar B

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.