Formatting bars in bar chart based upon selection in slicer

Hi there,

I’ve searched around but can’t find an easy answer.

I want to change the colour of the bar chart based upon the slicer selection. The slicer I have filters other visuals on the page, therefore, I don’t want to create a disconnected table as I’ve seen in other examples of how to solve this.

Is it possible?


Hi @corkemp.

You can change the bar colour by using a disconnected slicer, a measure, and conditional formatting.

In this small example, I made a [Disconnected Products] table and used it in the slicer. Then I used the following measure to harvest the selected value and set a HEX code:

Selected Product Conditional Formatting = 
VAR _SelectedProduct = SELECTEDVALUE( 'Disconnected Products'[Product Name] )
VAR _Result = IF( MAX( Products[Product Name] ) = _SelectedProduct, "#FF0000", "#0000FF" )


Finally, I set the data colour on the bar chart to the new measure.
eDNA Forum - Set Bar Chart Colour by Slicer Selection - 2

Curbal actually did a video last week that, among other things, illustrated this technique. See time index 5:10.

Hope this helps.
eDNA Forum - Set Bar Chart Colour by Slicer Selection.pbix (372.9 KB)


Hi @corkemp

As you asked for solution without using disconnected table AFAIK we need to have disconnected table. you can follow the below link where we had a healthy conversation on the same.


user want to have solution without using disconnected table. And when we have multiple visuals then it will not work :frowning:

eDNA Forum - Set Bar Chart Colour by Slicer Selection_Multiple visuals not working.pbix (374.2 KB)

Oops … missed that … very early in the morning when I replied (I hadn’t even had my first coffee yet…) Yeah, I think you unfortunately need a disconnected table.

Oh, seems we started taking this forum q&a first instead of coffee :rofl: credit to @EnterpriseDNA :handshake: :clap:

But learned other way of adding the different colour using Hex code in DAX. :+1:

Thanks for all your replies! I’ll have to live with the solution as it currently stands. Will be good if this functionality can be added in time.


1 Like

A response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!