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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sergioquerido
Helper I
Helper I

Conditional Formatting for Specific Column, Label (y-axis) or Date (x-axis)

Hi,
As in atthached  figure, am trying to highligh the day -7 and day -14 with a differemt color in x-axis (date), in the column or in label. Although the code is working well, it is not changing the color of the specific dates for date, column or label.Captura de ecrã 2024-09-28, às 13.53.27.png

 

 

 

 

 

 

 

 

 

I share also the code used:

ReferencePoints = 
VAR _teste1 = DATEDIFF(CALCULATE(MAX('1.0_DateFilter'[Date]), ALL('1.0_DateFilter'[Date])), MAX('1.0_DateFilter'[Date]), DAY)

RETURN
SWITCH(TRUE(), _teste1 = -7, 1,
_teste1 = -14, 2,
0)


How to solve? Any other solution for this situation?
Thanks.
SQ

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for Kedar_Pande and lbendlin's concern about this issue.

 

Hi, @sergioquerido 
I am glad to help you.

 

In Power BI, we can set all X-axis values to be uniformly a certain color:

vfenlingmsft_0-1727860063605.png

 

But unfortunately, it is not possible to individually display the value of an X-axis as a certain color by creating a conditional format, which is not directly supported by Power BI Desktop itself.

 

If you really want to display the X-axis values in a certain color, perhaps you can use it in conjunction with Table visual, something like this:

vfenlingmsft_1-1727861620274.png

 

I have attached the pbix file for this small example below, I hope it helps.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
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

4 REPLIES 4
Anonymous
Not applicable

Thanks for Kedar_Pande and lbendlin's concern about this issue.

 

Hi, @sergioquerido 
I am glad to help you.

 

In Power BI, we can set all X-axis values to be uniformly a certain color:

vfenlingmsft_0-1727860063605.png

 

But unfortunately, it is not possible to individually display the value of an X-axis as a certain color by creating a conditional format, which is not directly supported by Power BI Desktop itself.

 

If you really want to display the X-axis values in a certain color, perhaps you can use it in conjunction with Table visual, something like this:

vfenlingmsft_1-1727861620274.png

 

I have attached the pbix file for this small example below, I hope it helps.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

Best you can do with standard visuals is change the color of the bar.  For anything else you would need custom visuals.

Kedar_Pande
Super User
Super User

Create a Measure to Identify Special Days:

Kedar_Pande_0-1727529746508.png

 

Apply Conditional Formatting:

Kedar_Pande_1-1727529823081.png

 

Kedar_Pande_2-1727529839261.png

This approach should allow you to highlight those specific days with a different color.

 

Your Kudos/Likes are much appreciated!
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Regards,
Kedar Pande
www.linkedin.com/in/kedar-pande

Thanks @Kedar_Pande ,

The following code works with the conditional formatting for collumns and labels but not for dates in x-axis.

10.0_ReferencePoints = 
SWITCH(TRUE(),
SELECTEDVALUE('1.0_DateFilter'[Date]) = LASTDATE(ALL('1.0_DateFilter'[Date]))-7, 1,
SELECTEDVALUE('1.0_DateFilter'[Date]) = LASTDATE(ALL('1.0_DateFilter'[Date]))-14, 2,
0)



Captura de ecrã 2024-09-28, às 19.56.19.png

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors