Forum Discussion
Change colour within Clustered Column Chart based on Slicer
How do I change the colours dependent on slicer selection. I have 3 categories in my slicer - I would like each one to be a different colour when selected, ie Completed = green, Incomplete = red, Pending = Amber
14 Replies
- tharunkumarRTK
Super User
You can create a dax measure and use it for conditional formating
https://community.fabric.microsoft.com/t5/Desktop/Conditionally-format-bar-chart-column-colour-based-on-slicer/m-p/1002729 - Syndicate_Admin
Administrator
Hello, is the classification of the segmentation the same as the legend of the chart? That is, each of the sections of the stacked bar is a category of the state? If so, simply by clicking on the graphic and clicking on 'Format your visual' in the 'Visualizations' section you will find the 'Columns' option and in 'Series' you can click on each of them and modify their color, which appears just below.
- saud968
Memorable Member
You can go to the format pane, then go to columns click on fx, and then set rules accordingly.
Further, you can also create a custom column
Color = SWITCH(
MyTable[Status],
"completed", "green",
"incomplete", "red",
"pending", "amber",
"unknown" // Default color for any other status
)Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
- Whibley92
Helper II
Its just making them all Orange
- Whibley92
Helper II
I'm not using the slicer
- saud968
Memorable Member
These statuses are columns or measures. Also, the fx option you have to review other options and also did you try the custom column Dax
Below is another measure you can tryColor Measure =
SWITCH(
SELECTEDVALUE('SlicerTable'[Category]),
"Completed", "#00FF00", --Green
"Incomplete", "#FF0000", -- Red
"Pending", "#FFA500" -- Amber
)
Apply to Chart:
Go to the "Format" tab of your chart.
Select "Data colors" -> "fx"
Select the newly created "Color Measure."Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
- Whibley92
Helper II
I know why, sorry. The slicer doesnt break down the data in the chart when you click on it so I used a table.
So I have to use a slicer to get the colours but then it just does:
- saud968
Memorable Member
Have you tried this
Color Measure =
SWITCH(
SELECTEDVALUE('SlicerTable'[Category]),
"Completed", "#00FF00", --Green
"Incomplete", "#FF0000", -- Red
"Pending", "#FFA500" -- Amber
)
Apply to Chart:
Go to the "Format" tab of your chart.
Select "Data colors" -> "fx"
Select the newly created "Color Measure."Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!- Whibley92
Helper II
Yes I did, it just keeps them blue. I'm very new to Power BI so its probably really easy to do. Any advice on where I may be going wrong?
Color Measure =SWITCH(SELECTEDVALUE('Learning Item Status report'[Status Overall]),"Completed", "#5DDA7E", --Green"Incomplete", "#F43232", -- Red"Pending", "#F08439" -- Amber)