cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ansa_naz Member
Member

How do I ensure theme data colors are applied in a specific order?

Hi all

I have a stacked bar chart, which displays outstanding debt by customer, with a legend for the ageing bucket. The Ageing Bucket categories are:

 

1 - 0 Days

2 - 30 Days

3 - 60 Days

4 - 90 Days

5 - 120 Days

6 - 150 Days

7 - 180 Days

8 - 180+ Days

 

I want the bar chart legend data colors to go from dark green to dark red, left to right. My JSON has the following in the DataColors section:

 

"dataColors": ["#48740f", "#6c9a25", "#89bf36", "#aacc66", "#f2b52c" ,"#D79A12", "#bb7711", "#a11919"],

 

When I import this theme, the data colors are not being applied in left to right order, ie category '1 - 0 Days' to have a colour of dark green, to category '8 - 180+ Days' to have a data colour of dark red:

 

DataColors.jpgIncorrect Datacolor order for legend

 

DataColors2.jpgVisual DataColors settings

 

Does anyone know how I can ensure the data colours are applied as default in correct order? I have a few other visuals, so I need to make sure they are always applied in the order of the JSON file:

 

1 - 0 Days                     #48740f

2 - 30 Days                   #6c9a25

3 - 60 Days                   #89bf36

4 - 90 Days                   #aacc66

5 - 120 Days                 #f2b52c

6 - 150 Days                 #D79A12

7 - 180 Days                 #bb7711

8 - 180+ Days              #a11919

 

Many thanks for all help

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How do I ensure theme data colors are applied in a specific order?

hi,@ansa_naz

    After my research, Power BI uses the color along the horizontal of the color-picker, which could avoid two similar colors getting together.

32.PNG

So you can do these follow my steps

Step1:

Add a conditional column in PowerQuery

30.PNG

Step2:

Use group By function

select field Data color and Click Modeling ->Sort by column->Custom

31.PNG

Result:

33.PNG

 

By the way, due to the cache, It will not be effective immediately, you need to save and reopen the pbix.

 

Best Regards!

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: How do I ensure theme data colors are applied in a specific order?

hi,@ansa_naz

    After my research, Power BI uses the color along the horizontal of the color-picker, which could avoid two similar colors getting together.

32.PNG

So you can do these follow my steps

Step1:

Add a conditional column in PowerQuery

30.PNG

Step2:

Use group By function

select field Data color and Click Modeling ->Sort by column->Custom

31.PNG

Result:

33.PNG

 

By the way, due to the cache, It will not be effective immediately, you need to save and reopen the pbix.

 

Best Regards!

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ansa_naz Member
Member

Re: How do I ensure theme data colors are applied in a specific order?

Thanks! This worked except I had to make a change. In modelling, I selected 'Age Buckets'  field and sorted by 'Custom' column