Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not 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 employee join again i need add colors

 

please anybody have idea how to give repeat colors once complete 12 color again need start 1st color to 12

 

 

Thnaks

Shanvitha

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hey, @Shanvitha01

According to your description, I created data to reproduce your scenario. The pbix file is attached at the end.

Mesa:

a1.png

You can go to 'Query Editor' and add an index column on the Add Column ribbon.

a2.png

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.

a3.png

a4.png

Result:

a5.png

Best regards

Allan

If this post helps,then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@Anonymous , have you set those colors in theme or you are creating a color measure?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.