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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
emarc1
Advocate II
Advocate II

Conditional formatting of matrix date columns

I'd like to highlight date columns in a matrix if they contain today's date. My current solution is to use conditional formatting rules based on a measure that calculates if today falls within the dates selected:

 

Today in Date Range = 
VAR minDate = MIN( 'Calendar'[Date] )
VAR maxDate = MAX( 'Calendar'[Date] )
RETURN
IF( TODAY() >= minDate && TODAY() <= maxDate, 1, 0 )

 

The problem is that any cells that don't have values don't get conditionally formatted:

Capture.PNG

The calendar is related to the values by a date field.

Is there a way to do this that also conditionally formats the blanks within that column?

I'd also like this to remain dynamic so it still works if the columns change to different date ranges (days or months).

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@emarc1 , Power bi does not color blank rows. I tried a color measure with isblank too.

 

Try if this can work

 

Today in Date Range =
VAR minDate = MIN( 'Calendar'[Date] )
VAR maxDate = MAX( 'Calendar'[Date] )
RETURN
IF( TODAY() >= minDate && TODAY() <= maxDate && [measure]+0 <> blank() 1, 0 )

 

measure is the value you are using in matrix

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
emarc1
Advocate II
Advocate II

Hmm, I suspected that might be the case. I did experiment with your code amendments but didn't have any luck. I think the only way to do it would be to replace all blanks with zeroes (in the value measure), which would probably result in performance issues instead. It's a shame, because being able to dynamically highlight certain time periods feels very useful, from a UX perspective.

Thanks for your help.

amitchandak
Super User
Super User

@emarc1 , Power bi does not color blank rows. I tried a color measure with isblank too.

 

Try if this can work

 

Today in Date Range =
VAR minDate = MIN( 'Calendar'[Date] )
VAR maxDate = MAX( 'Calendar'[Date] )
RETURN
IF( TODAY() >= minDate && TODAY() <= maxDate && [measure]+0 <> blank() 1, 0 )

 

measure is the value you are using in matrix

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.