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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CherylHe
New Member

Custom colours for the X-axis of the Power BI 100% Stacked column chart control do not take effect

Custom colours for the X-axis of the Power BI 100% Stacked column chart control do not take effect.

The same custom colours for the metrics can be displayed effectively in the table, but when added to the x-axis of the chart, they do not display correctly.

code:

VALUE_COLOR =
SWITCH(SELECTEDVALUE('表'[Brand]),
       "OMO","#C00000"
       ,"#000000")
 
table display:
CherylHe_0-1709780263998.png

100% Stacked column chart display:

CherylHe_2-1709780378116.png

 

CherylHe_1-1709780356111.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CherylHe ,

So far, in terms of settings for the visual ontology (display data, row and column titles, X or Y-axis, etc.), conditional formatting only works on table and matrix visual objects. It does not work on charts.

vjunyantmsft_0-1710299933212.png

Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

vjunyantmsft_1-1710299953659.png

But I can give you a workaround, just put the column Brand into any of the Title, Value, and Detail to set the conditional formatting. Below I will use Title as an example to demonstrate:

vjunyantmsft_2-1710300637265.png

vjunyantmsft_3-1710300669728.png

The final output is as below:

vjunyantmsft_4-1710301009842.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @CherylHe ,

So far, in terms of settings for the visual ontology (display data, row and column titles, X or Y-axis, etc.), conditional formatting only works on table and matrix visual objects. It does not work on charts.

vjunyantmsft_0-1710299933212.png

Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

vjunyantmsft_1-1710299953659.png

But I can give you a workaround, just put the column Brand into any of the Title, Value, and Detail to set the conditional formatting. Below I will use Title as an example to demonstrate:

vjunyantmsft_2-1710300637265.png

vjunyantmsft_3-1710300669728.png

The final output is as below:

vjunyantmsft_4-1710301009842.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Clever workaround! I tried it and it works pretty well.
Have you also an idea for stacked bar charts? The problem for me is, that the labels are only within the stacked fields, but not above the bars.
So I chose to only label the most upper field, so that there is only one laber per bar, but that only functions when the field is big enough. Currently I have half of the fields labeld, because they are big enough and the rest not. (It is already at the smallest text size and biggest visual / bar size)

RossEdwards
Solution Sage
Solution Sage

I'm assuming you have 2 different tables.  First Table has 2 columns: Brand and Value_Color.

The second table has 2 columns: Brand and Value

 

Have you created a relationship between these 2 tables (brand to brand)?  I'm wondering if there is no filter context and the model isn't filtering the Color table.

All dimensions, indicators information is contained in only one table;The same colour judgement logic can be converted into a table form to show its effect

I'm getting the same result as you.  I think its something to do with the X-Axis font colour.  If i try to put it on the Bar colours at the same time, i get some weird error.  Remove it from the X-Axis font colour then the bar colours work fine (error goes away).

 

Screenshot.PNG

yes,i think chart x-axis custom color the function doesn't work.

I don't know if it's a bug in the software.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.