In this article you will see how to change the background color for specific rows in a matrix based on values in column.
Here, we have a matrix which displays the Total sales by segment & year.
Lets change the background color for specific rows based on values in column.
Assume that, we want to change the row background color based on Segment values, for “Channel Partners” it should be Light blue, for “Enterprise” it should be Yellow, for “Midmarket” it should be an Orange.
Now we will create a column which will return the color based on value in a column.
Go to filed pane, right click on table and select New column from context menu.
Now write a following DAX, it uses switch function which return hexacode for color when expression match the corresponding segment value.
ChangeColor = SWITCH ( financials[Segment], "Channel Partners", "#ADD8E6", "Enterprise", "#FFFF00", "Midmarket", "#FFA500" )
Lets change the color for segment “Government” to Green and “Small Business” to Red.
SWITCH ( financials[Segment], "Channel Partners", "#ADD8E6", "Enterprise", "#FFFF00", "Midmarket", "#FFA500", "Government", "#93C47D", "Small Business", "#FF0000" )
2,020 total views, 1 views today