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
cottrera
Post Prodigy
Post Prodigy

Conditional format time in matrix - using dax

Hi

 

I have a matix visual that contains peoples names in the first column, dates across the header row and the values are times hh:mm:ss.  I would like to conditionally format the time values if they meet the criteria below. I am asuming this woud have to be done in dax

Before 16:00:00 = Red

Between 16:00:00 - 17:00:00 = Orange

Between 17:00:00 - 17:30:00 = Green

Between 17:30:00-18:00:00 = Blue

After 18:00:00 = Grey

 

Example of matrix

 

Alan17:25:3517:48:1117:48:11
Alistair16:49:3217:06:1717:06:17
Andrew19:15:0023:30:0023:30:00
Anthony17:34:3517:32:3517:34:35
Bradley00:00:0023:30:0023:30:00
Carl17:54:2118:02:3418:02:34
Curtis17:41:4316:48:4317:41:43
Dave18:01:0817:24:5918:01:08

 

thank you Richard

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@cottrera , Create a color measure like

 

Switch(True(),
max([time]) =<time(16,0,0) , "red",
max([time]) >time(16,0,0) && max([time]) =<time(17,0,0), "Green",
max([time]) >time(17,0,0) && max([time]) =<time(18,0,0), "Blue",
"grey"
)

 

use that in conditional formatting with field value option

 

refer for steps :

https://www.youtube.com/watch?v=RqBb5eBf_I4

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
cottrera
Post Prodigy
Post Prodigy

Works perfectly thank you as always😁

amitchandak
Super User
Super User

@cottrera , Create a color measure like

 

Switch(True(),
max([time]) =<time(16,0,0) , "red",
max([time]) >time(16,0,0) && max([time]) =<time(17,0,0), "Green",
max([time]) >time(17,0,0) && max([time]) =<time(18,0,0), "Blue",
"grey"
)

 

use that in conditional formatting with field value option

 

refer for steps :

https://www.youtube.com/watch?v=RqBb5eBf_I4

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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