Forum Discussion

PBIUser2024's avatar
PBIUser2024
Frequent Visitor
2 years ago

Dynamic Colours in grouped Bar Chart

Hi,

 

i do have a grouped bar chart with many bars, which will still grow:

 

By Slicer, only 2 of these bars will be shown for the user, he will be able to switch between them:

The problem is, that every Bar has its own colour, so by switching it they will always change. I am working with a custom colour palette, but I have reached a point the colours don't fit to the scheme anymore. Is there a way to give the 2 bars always the same colour? This visual does not have the option to have conditional colours (fx), is there a alternativ visual to try?

 

Cheers

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi PBIUser2024 ,

    Based on the information you have provided, I have created a sample data for you, which you can follow at the yellow mark to transform the colour of the column to the same:

    Sample data:

    Change the colour:

     

    Final output:

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • PBIUser2024's avatar
      PBIUser2024
      Frequent Visitor

      Thank you for your reply Anonymous . Unfortunately, the visual needs to be much more dynamic, there will be a lot of ID's and they will grow, it is not an Option to change the colour everytime manually. 

       

      The visual always shows 2 ID's, based on the 2 Slicer. I want the left and right bar to always have the same colors, e.g. left always red, right always blue. Regardless of the IDs selected. I have reworked and added to your example: 

      2 new tables which only have the distinct 'ID' of 'Table' (DimID1 and DimID2). Each Slicer uses one of the tables.

      a new Measure: 

      Or Filter =
      IF (
          SELECTEDVALUE ( 'Table'[ID] )
              IN UNION ( ALLSELECTED ( DimID1[ID]), ALLSELECTED ( DimID2[ID] ) ),
          "Y",
          "N"
      )
      This Measure is used as a filter on the bar char, filtering on ='Y'. 
       
      Cheers