Forum Discussion
Anonymous
5 years agoNot applicable
Dynamic colors in bar
Hi Team, I have 12 Custom colors but my x-axix value is employee my employee is 200 How to repeat 12 colors beacause manually add color each employee it take time and also feature new employ...
v-alq-msft
Community Support
5 years agoHey, @Shanvitha01
According to your description, I created data to reproduce your scenario. The pbix file is attached at the end.
Mesa:
You can go to 'Query Editor' and add an index column on the Add Column ribbon.
You can then create a measure as shown below.
Visual Control =
var val = MOD(MAX('Table'[Index]),12)
return
SWITCH(
val,
1,"salmon",
2,"red",
3,"blue",
4,"green",
5,"grey",
6,"pink",
7,"purple",
8,"deeppink",
9,"orange",
10,"gold",
11,"yellow",
0,"skyblue"
)
Finally, you must set 'fx' for the default color of the visual.
Result:
Best regards
Allan
If this post helps,then consider Accepting it as the solution to help other members find it faster.