Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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!
User | Count |
---|---|
123 | |
76 | |
62 | |
50 | |
50 |
User | Count |
---|---|
175 | |
125 | |
60 | |
60 | |
58 |