Forum Discussion
Adding a new row to matrix
- 1 year ago
Hi leila675 - Create a disconnected table for row labels
GroupList =
DATATABLE("Group", STRING, {
{"Group A"},
{"Group B"},
{"Group C"},
{"Variance"}
})create a measure for totals to return Total2
NewTotal =
VAR SelectedGroup = SELECTEDVALUE(GroupList[Group])
RETURN
SWITCH(
TRUE(),
SelectedGroup = "Group A", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group A"),
SelectedGroup = "Group B", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group B"),
SelectedGroup = "Group C", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group C"),
SelectedGroup = "Variance",
CALCULATE(SUM(Table1[Value])) - CALCULATE(SUM(Table2[Value])),
BLANK()
)now place new total at values , Power BI will auto-calculate the Grand Total row (i.e., 47). Hope this works.
Hi leila675 - Create a disconnected table for row labels
GroupList =
DATATABLE("Group", STRING, {
{"Group A"},
{"Group B"},
{"Group C"},
{"Variance"}
})
create a measure for totals to return Total2
NewTotal =
VAR SelectedGroup = SELECTEDVALUE(GroupList[Group])
RETURN
SWITCH(
TRUE(),
SelectedGroup = "Group A", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group A"),
SelectedGroup = "Group B", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group B"),
SelectedGroup = "Group C", CALCULATE(SUM(Table2[Value]), Table2[Group] = "Group C"),
SelectedGroup = "Variance",
CALCULATE(SUM(Table1[Value])) - CALCULATE(SUM(Table2[Value])),
BLANK()
)
now place new total at values , Power BI will auto-calculate the Grand Total row (i.e., 47). Hope this works.