cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Clustered Bar Chart - Bar Colour Depends on Position of Bar

I have a slicer of dates where a user can choose 1 or more dates (multiple selection). The expected scenario is for the user to choose 2 dates, where the intention is to show values on a clustered column chart comparing values as at the 2 selected dates for each of a number of scenarios. I have configured the chart such that the chart legend shows the 2 selected dates, and the bar colours are chosen (eg date 1 bar colour is grey and date 2 bar colour is blue for all scenarios).

 

All good and well. The problem comes when the date selection is changed by the user. I need my bars to all stay the same colour as originally chosen ie whichever 2 dates the user selects, the earlier date bars must always be grey, and the later date bars must always be blue. In many searches and trials so far, I have not been able to achieve this - the bars always change colour as the dates are changed to different dates because the bar colour is associated with the date and not with the position of the bar in the chart. I would like to know if anyone has either achieved this before or has some ideas on how to achieve this.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

@mrmrb 

 

Drag [Date] to Axis instead of Legend and try Color formatting by field value from the Data colors card in the formatting pane.

 

Measure =
IF (
    SELECTEDVALUE ( 'Table'[Date] )
        = CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) ),
    "#808080",
    "#0000FF"
)

 

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

@mrmrb 

 

Drag [Date] to Axis instead of Legend and try Color formatting by field value from the Data colors card in the formatting pane.

 

Measure =
IF (
    SELECTEDVALUE ( 'Table'[Date] )
        = CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) ),
    "#808080",
    "#0000FF"
)

 

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Thank you very much for your suggestion. This achieves what I need in terms of the colour consistency. Unfortunately moving the date to the Axis instead of the Legend means that the bars no longer group together neatly as before, and also the axis labels become crowded...

             Target ViewTarget View                                Achieved so farAchieved so far

There isn't an option to apply the conditional colour formatting when the date is in the legend, so I may not be able to get any closer to the target view for now. But this is definitely a step in the right direction. My thanks, once again.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors