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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
StuartSmith
Power Participant
Power Participant

Conditional Table row colour - Past date red, today orange and future dates green.

Is there a way so that a table will have red rows (either font or backgrond) for dates older than today, current date orange and future dates green?

2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

@StuartSmith 

yes. conditional formatting option https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

 

create a column like

Colour = 
SWITCH(TRUE(),
Table[Date] < TODAY(), "red",
Table[Date] = TODAY(), "orange",
"green")

and use it as field rule in conditional formatting


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

View solution in original post

az38
Community Champion
Community Champion

Hi @StuartSmith 

try

Contract_End_Date_Colour_Formatting_Columnn =
SWITCH(TRUE(),
'Carrier Matrix'[ContractEndDate] < TODAY(), "red",
'Carrier Matrix'[ContractEndDate] = TODAY(), "orange",
DATEDIFF(TODAY(), 'Carrier Matrix'[ContractEndDate], MONTH) <= 6 , "Blue",
"Green")

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

View solution in original post

6 REPLIES 6
az38
Community Champion
Community Champion

@StuartSmith 

yes. conditional formatting option https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

 

create a column like

Colour = 
SWITCH(TRUE(),
Table[Date] < TODAY(), "red",
Table[Date] = TODAY(), "orange",
"green")

and use it as field rule in conditional formatting


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

@az38 Hi, your above solution worked great, and now trying to develop it.  Is there a way so that if any date is between today and the next 6 months, its blue.

 

This would then highlight any date that falls between today and 6 months in the future.

Thanks in advance

 

So something like...

 

Contract_End_Date_Colour_Formatting_Columnn =
SWITCH(TRUE(),
'Carrier Matrix'[ContractEndDate] < TODAY(), "red",
'Carrier Matrix'[ContractEndDate] = TODAY(), "orange",
'Carrier Matrix'[ContractEndDate] > TODAY() || < 6Month in future , "Blue",
"Green")

 

Obviously the "< 6Month in future" is valid code, 😁

az38
Community Champion
Community Champion

Hi @StuartSmith 

try

Contract_End_Date_Colour_Formatting_Columnn =
SWITCH(TRUE(),
'Carrier Matrix'[ContractEndDate] < TODAY(), "red",
'Carrier Matrix'[ContractEndDate] = TODAY(), "orange",
DATEDIFF(TODAY(), 'Carrier Matrix'[ContractEndDate], MONTH) <= 6 , "Blue",
"Green")

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

Thats great and thanks

Thanks

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors