Forum Discussion
Matrix Adding total from previous Group
- 3 months ago
Hi nagendranath,
Thank you for reaching out to Microsoft Fabric Community Forum.
The requirement is for a cumulative or running total across groups, not just a standard group subtotal.For instance:
- Total Machinist = 475
- Total Machinist Including Trainee = 475 + 13 = 488
This means each subsequent group should include the totals from the preceding groups.
This result can't be achieved with only Matrix grouping or subtotal options. Instead, you should use a Running Total measure in DAX.
First Create an Order column
Assign a numeric order to your groups so Power BI can determine the sequence.
Example:
GroupOrderMachinist1Machinist Including Trainee2Supervisor3Supervisor Including Trainee4
Ensure the Group column is sorted by the Order column.
Next Build the Running Total MeasureRunning Total =
VAR CurrentRank =
MAX ( 'Table'[Order] )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table'[Group], 'Table'[Order] ),
'Table'[Order] <= CurrentRank
)
)Later Apply the Measure in Matrix
Replace the current total measure in your Matrix visual with this new Running Total measure.
The result will be:
- Machinist = 475
- Machinist Including Trainee = 488
- Each following group = Previous total + Current group total
This method offers flexibility and allows you to rank groups and carry totals forward dynamically.
Thank you.
It will group those into one Group but for the next group i need this total. Which is not possible if i group.
You Can make Sub_Group when you make grouping as the attached photo ,
I attached for you how should the grouping be like with some sitting along to have the result as you desire
After Grouping make this Setting:
01st make the Layout as Tabuar:
02nd Setup the Row Subtotals Setting:
The End Result:
Best of luck
- nagendranath3 months agoFrequent Visitor
I need for "Total Machinsit Including Trainee" should be 475+13 not only for that individual group i need the value of "Total machinist" group also like that i need to refer total from prev group in the next group and show the total. Basically i need to rank each group
& add totals i beileve.