Forum Discussion

tahechadv_2022's avatar
3 years ago
Solved

Dynamic Bar Color

Hi guys!   In the following chart, it shows a graph and two filters. "Previsão de Êxito" and "Tipo de Conquista" I want to change the color of the bars in the chart according to the "Tipo de...
  • dcrosseto's avatar
    3 years ago

    Hi tahechadv_2022 ,

     

    You can use the SELECTEDVALUE function pointing to the filter and then based on the result, you choose a color, something like this

     

    var filter_selected = SELECTEDVALUE('column used on the slicer')

    return

    SWITCH(

         TRUE(),

         filter_selected = "Economia", "Red",

         filter_selected = "Ganho", "Gray",

         "#FFFFFF" -- you can also use hex code

    )

     

    After creating this measure, you apply a Field Value to the colors, on the path below

     

    https://prnt.sc/1wBO_R8f3UsN

     

    Hope it helps,

     

    Regards,

    Douglas.