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
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
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