Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi, I am stuck with fixing the sub total for a matrix table I am using to create a report. The measure I created is using a switch function to check row category/level to provide specific calculation however I would like the sub total to sum all the values in each row in the table.
Category | Measure |
A | 5 |
B | 10 |
C | 20 |
total | 35 |
using the switch function If category is B then 2 * [value of A], if category is C, then its 4*[value of A] . The total should show the sum of the values in the table.
Solved! Go to Solution.
Hi, @Sage477
You can try the following methods.
Measure 1 =
VAR _SumA=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Category]="A"))
RETURN
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Category])="A",_SumA,
SELECTEDVALUE('Table'[Category])="B",2*_SumA,
SELECTEDVALUE('Table'[Category])="C",4*_SumA,BLANK())
Measure Result =
Var _table=SUMMARIZE('Table','Table'[Category],"Sum",[Measure 1])
Var _Sumtotal=SUMX(_table,[Sum])
RETURN
IF(HASONEVALUE('Table'[Category]),[Measure 1],_Sumtotal)
Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Sage477
You can try the following methods.
Measure 1 =
VAR _SumA=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Category]="A"))
RETURN
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Category])="A",_SumA,
SELECTEDVALUE('Table'[Category])="B",2*_SumA,
SELECTEDVALUE('Table'[Category])="C",4*_SumA,BLANK())
Measure Result =
Var _table=SUMMARIZE('Table','Table'[Category],"Sum",[Measure 1])
Var _Sumtotal=SUMX(_table,[Sum])
RETURN
IF(HASONEVALUE('Table'[Category]),[Measure 1],_Sumtotal)
Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
you can try this
Proud to be a Super User!
Hi thanks but the sub total is still showing incorrectly, it should add the values in the table.
then you create another meausre
measure2=sumx(values('table'[catogry]),measure)
Proud to be a Super User!