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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
di_12
Regular Visitor

Conditional formatting not applying on axis based on values in same table

I'm struggling trying to apply conditional formatting to the Y-Axis labels, I setup a test table as follows:

di_12_1-1735067908767.png

And a bar chart to display that data

di_12_2-1735067975184.png

My goal is to have the date value be either one of two colors depending on if that day's "RandomBinary" value. I've added the "ColorText" column and tried using that as the field for the formatting, no luck. A measure (

colorMeasure = SELECTEDVALUE(Query1[ColorText],"Pink") ) will always return Pink.

I'm really not sure how to get this to work correctly; there doesn't seem to be an inherent way to tie the formatting to each date by using formatting only, and any rules will apply only one value to the entire axis unless I use a filter to remove all of the other value. Is there any way to get this to work date-by-date?

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @di_12 

Unfortunately the conditional formatting for the axis font color is evaluated once in the overall filter context of the visual, not separately for each value on the axis. This means the axis font color will always be the same for all values. 😞

(You can verify this by examining the DAX query for the visual.)

 

One workaround might be to get creative with data labels, which are formatted per data point. For example, you could

  1. Use a stacked bar chart.
  2. Create a dummy constant measure and display it below the existing measure.
  3. Use a measure returning the date value as a data label  for the dummy measure.
  4. Apply conditional formatting the the data label font color.
  5. Create a reference line to act as the axis if required.

Small example of this method attached. It's a bit inconvenient and there may be formatting issues, but it's at least an option.

OwenAuger_0-1735111810751.png

 

Alternatively, you could look at using something like Deneb where you can customize the logic more easily, or there may be another suitable custom visual out there.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
v-xianjtan-msft
Community Support
Community Support

Hi @di_12 

 

First, thanks to OwenAuger and Ritaf1983 for their great responses to this thread.


Currently Power BI does not support applying conditional formatting to values based on axes. However, both OwenAuger and Ritaf1983 have provided great alternatives in their replies to achieve a similar effect. So if these help you solve your problem, please consider accepting their replies as a solution.
If this feature is important to you, you can also submit an idea on ideas.fabric.microsoft.com.

 

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

Ritaf1983
Super User
Super User

Hi @di_12 

I must admit that I didn’t fully understand the logic of what you’re trying to achieve, so I’ll try to assist with just the technical aspect.

The main point is that we don’t have an option for conditional formatting on axis labels in charts.

To work around this, you can either use labels instead of the axis or create a chart with a combined table.

 

Ritaf1983_0-1735109675473.png

 

I’m attaching a PBIX file with two examples. You can take a look at what I’ve done, and if you have any questions, feel free to ask.

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
OwenAuger
Super User
Super User

Hi @di_12 

Unfortunately the conditional formatting for the axis font color is evaluated once in the overall filter context of the visual, not separately for each value on the axis. This means the axis font color will always be the same for all values. 😞

(You can verify this by examining the DAX query for the visual.)

 

One workaround might be to get creative with data labels, which are formatted per data point. For example, you could

  1. Use a stacked bar chart.
  2. Create a dummy constant measure and display it below the existing measure.
  3. Use a measure returning the date value as a data label  for the dummy measure.
  4. Apply conditional formatting the the data label font color.
  5. Create a reference line to act as the axis if required.

Small example of this method attached. It's a bit inconvenient and there may be formatting issues, but it's at least an option.

OwenAuger_0-1735111810751.png

 

Alternatively, you could look at using something like Deneb where you can customize the logic more easily, or there may be another suitable custom visual out there.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors