Forum Discussion

tuncay's avatar
tuncay
Helper III
3 years ago
Solved

Custom column chart colors

Hello,

 

I want to change colors based on the selected factory.

If the factory begins with "A" it should be this color etc.

 

However there are also factories, where I need to put the whole name like the last one in the code...

But this does not work...

 

  • found the solution 😉

     

    ColumnColors = 
    SWITCH(TRUE(),
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "A", "#008F8C",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "E", "#DAFDBA",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "I", "#9AEBA3",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "R", "#45C4B0",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "T", "#13678A",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "U", "#012030",
    SELECTEDVALUE('KPI Data'[Factory]) = "BRK",  "#008F8C")

2 Replies

  • LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "A", "012030",
    "E", "#DAFDBA",

    does not work...

  • found the solution 😉

     

    ColumnColors = 
    SWITCH(TRUE(),
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "A", "#008F8C",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "E", "#DAFDBA",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "I", "#9AEBA3",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "R", "#45C4B0",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "T", "#13678A",
    LEFT(SELECTEDVALUE('KPI Data'[Factory]), 1) = "U", "#012030",
    SELECTEDVALUE('KPI Data'[Factory]) = "BRK",  "#008F8C")