Forum Discussion
Customize colors for measures on a column chart
Hello,
I have a column chart displaying multiple measures on Y-axis as you can see in the screenshot below. I have a measure created to change color based on a value. Here's my color measure:
Hi VJ_Lsf
The conditional formatting option is not available when using multiple measures on the graph.
In order for it to work,
the list of measures needs to be placed on the X-axis,
like shown in the image,
and then there is no problem creating a color measure like:S1ColumnColor =
VAR S1Target = 95
RETURN IF (
SELECTEDVALUE('Table'[S]) = "S1",
IF(SUM([% from target]) < S1Target, "Red", "Green"),
"Grey"
)and apply conditional formatting only on the desired category.
To assist you better, it’s important to understand why you built four separate measures.
If it’s because you have a column for each category, it’s worth considering doing an unpivotand reaching a structure similar to mine.
If it's for a different reason, you can use an unrelated table and a dynamic measure / field parametrs.
To help you further, please save a sample PBIX file to a public drive and share the link.
In any case, I’ve attached a PBIX with my example.If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
3 Replies
- Ritaf1983
Super User
Hi VJ_Lsf
The conditional formatting option is not available when using multiple measures on the graph.
In order for it to work,
the list of measures needs to be placed on the X-axis,
like shown in the image,
and then there is no problem creating a color measure like:S1ColumnColor =
VAR S1Target = 95
RETURN IF (
SELECTEDVALUE('Table'[S]) = "S1",
IF(SUM([% from target]) < S1Target, "Red", "Green"),
"Grey"
)and apply conditional formatting only on the desired category.
To assist you better, it’s important to understand why you built four separate measures.
If it’s because you have a column for each category, it’s worth considering doing an unpivotand reaching a structure similar to mine.
If it's for a different reason, you can use an unrelated table and a dynamic measure / field parametrs.
To help you further, please save a sample PBIX file to a public drive and share the link.
In any case, I’ve attached a PBIX with my example.If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- VJ_LsfFrequent Visitor
I currently have a separate column for each 'S', so I can't switch them to the X-axis. The measures are calculated using various other measures and seperate columns. I'll try unpivoting the data into a structure that supports this approach. Looks like that should work. Thank you
- lbendlin
Super User
I have a column chart displaying multiple measuresInstead, create a single measure and use the Legend field to distinguish the columns. Then you can use another measure to define the color for each legend.