Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
How to write DAX to get % of Row total for below table.
Expected result is % of row total(Ach) & % of row total(Bre)
Pri | Ach | Bre | % of row total(Ach) | % of row total(Bre) | Dax(% of row total(Ach) | Dax(% of row total(Bre) |
S1 | 84 | 1 | 98.82% | 1.18% | ||
S2 | 457 | 2 | 99.56% | 0.44% | ||
S3 | 975 | 2 | 99.80% | 0.20% | ||
S4 | 4 | 100.00% | 0.00% | |||
S5 | 2 | 100.00% | 0.00% | |||
Total | 1522 | 5 | 99.67% | 0.33% |
Regards,
Chandrashekar B
Solved! Go to Solution.
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 )
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.
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 )
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
@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]) ))
Hello Amit,
Ach is not a measure it is direct value.
Regards,
Chandrashekar B
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |