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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
HenryJS
Post Prodigy
Post Prodigy

Date Colour Coding Conditional Formatting

Hi all,

 

I would like to create a conditional formatting to the below 'Available' date column.

 

The conditions would be:

  • Green for 2 weeks in future
  • Amber for 2 weeks in past
  • Red for >2 weeks in the past

 

 

 

dax15.PNG

 

 

 

 

Thanks,

 

Henry

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @HenryJS 

create a calcualted column

Column = SWITCH(TRUE(),
DATEDIFF(TODAY(), [Available], WEEK) > -1 && DATEDIFF(TODAY(), [Available], WEEK) <=2, "Green",
DATEDIFF(TODAY(), [Available], WEEK) < 0 && DATEDIFF(TODAY(), [Available], WEEK) >= -2, "Amber",
DATEDIFF(TODAY(), [Available], WEEK) < -2, "Red",
BLANK()
)

then set this column as a field for conditional formatting in the visual settings

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @HenryJS 

create a calcualted column

Column = SWITCH(TRUE(),
DATEDIFF(TODAY(), [Available], WEEK) > -1 && DATEDIFF(TODAY(), [Available], WEEK) <=2, "Green",
DATEDIFF(TODAY(), [Available], WEEK) < 0 && DATEDIFF(TODAY(), [Available], WEEK) >= -2, "Amber",
DATEDIFF(TODAY(), [Available], WEEK) < -2, "Red",
BLANK()
)

then set this column as a field for conditional formatting in the visual settings

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

My powerbi didn't even recognize switch. This looked so promising but did not work for me

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.