Forum Discussion
Calculated Measure in Row
- Anonymous2 years ago
Hi ChrisFromOhio ,
Please try the following methods and check if they can solve your problem:
1.Create a measure for Sales $.
Sales Amount = SUMX(FILTER('Table', 'Table'[Attribute] = "Sales $"), 'Table'[Value])2.Create a measure for Sales U.
Sales U = SUMX(FILTER('Table', 'Table'[Attribute] = "Sales U"), 'Table'[Value])3.Create a measure for Cost $.
Cost Amount = SUMX(FILTER('Table', 'Table'[Attribute] = "Cost $"), 'Table'[Value])4.Create a measure for Margin.
Margin = DIVIDE([Cost Amount], [Sales Amount], BLANK())5.Create a disconnected table that lists the attributes.
6.Create the conditional measure for display.
Display Value = SWITCH( SELECTEDVALUE('Table Ro'[Attribute]), "Sales U", [Sales U], "Sales $", [Sales Amount], "Cost $", [Cost Amount], //"Margin", [Margin], "Margin", FORMAT([Margin], "0.0%"), BLANK() )7.Drag the new table to the Rows in the matrix visual and Drag the conditional measure into the Values area.
8.The result is shown below.
Best Regards,
Wisdom Wu
So the Margin will only show up in the subtotal line? What if I wanted it before another attribute?
Hi ChrisFromOhio ,
Please try the following methods and check if they can solve your problem:
1.Create a measure for Sales $.
Sales Amount = SUMX(FILTER('Table', 'Table'[Attribute] = "Sales $"), 'Table'[Value])
2.Create a measure for Sales U.
Sales U = SUMX(FILTER('Table', 'Table'[Attribute] = "Sales U"), 'Table'[Value])
3.Create a measure for Cost $.
Cost Amount = SUMX(FILTER('Table', 'Table'[Attribute] = "Cost $"), 'Table'[Value])
4.Create a measure for Margin.
Margin = DIVIDE([Cost Amount], [Sales Amount], BLANK())
5.Create a disconnected table that lists the attributes.
6.Create the conditional measure for display.
Display Value =
SWITCH(
SELECTEDVALUE('Table Ro'[Attribute]),
"Sales U", [Sales U],
"Sales $", [Sales Amount],
"Cost $", [Cost Amount],
//"Margin", [Margin],
"Margin", FORMAT([Margin], "0.0%"),
BLANK()
)
7.Drag the new table to the Rows in the matrix visual and Drag the conditional measure into the Values area.
8.The result is shown below.
Best Regards,
Wisdom Wu