Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Highlighting Selected Show in Bar Chart

Hi All, 

 

Does anyone know how can you highlight a bar in a barchart with a dropdown filter, without hiding the rest of the values/bars

 

Please let me know if you need any more information, as I fear this is not as simple as I hoped!

 

Thanks in advance, and help would be greatly appreciated!

 

  • MFelix's avatar
    MFelix
    6 years ago

    Hi Anonymous ,

     

    In your measure you are not comparing nothing so the result is not getting the highlith you need.

     

    Measure = SWITCH(TRUE(),SELECTEDVALUE('Processed Data'[Title]) =  SELECTEDVALUE(TAble[Slicer]),"#800000")

    I have added a part of the formula that you need to compare with the slicer you have. 

     

3 Replies

  • Hi Anonymous ,

     

    Create a table with the values you want for our slicer assuming that is based on the x-axis value of the bar chart. Do not relate this with your other tables.

     

    Then add the following measure:

    Measure = SWITCH(TRUE();SELECTEDVALUE('Table'[X-AxisColumn]) = SELECTEDVALUE(SlicerTable[Colun]); "#000000")

     

    Now go to the bar chart data columns and use the conditional formatting with the field value and select this measure.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi MFelix

       

      Thanks so much for this, I am relatively new to Power BI and Dax but this has helped a lot!

       

      However, unfortunately I am having some issues; this is my version of the measure: 


      Measure = SWITCH(TRUE(),SELECTEDVALUE('Processed Data'[Title]),"#800000")
       
      Then in the Data Colors I changed the conditional formatting to "Format by Field Value" then based on the field "Title" (I chose First as it had to be either First or Last). However, the table pops up with a yellow warning sign now and the bars haven't changed colours. The warning says "We found a value we don't recognise for default colour" - I looked up the colour sopecifically so I believe it is one, do you have any idea how I can fix this?
       
      Thanks

       

       

       

       

       

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User

        Hi Anonymous ,

         

        In your measure you are not comparing nothing so the result is not getting the highlith you need.

         

        Measure = SWITCH(TRUE(),SELECTEDVALUE('Processed Data'[Title]) =  SELECTEDVALUE(TAble[Slicer]),"#800000")

        I have added a part of the formula that you need to compare with the slicer you have.