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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ansa_naz
Continued Contributor
Continued Contributor

Matrix - Create measure to see if a row date value is within the column year/month

Hi all

 

Is there any way to create a measure which compares the row value date with the matrix column Year/Month, and if the row date value is AFTER the column Year/Month then highlight it red?

 

See below current matrix, I am trying to highlight the background in red all cells where the maintenance completed date is AFTER the column Year/Month - these have been surounded with black borders:

 

Maintenance2.jpg

 

The Year/Month column values come from a Dates table, and the row date values come from my maintenance dataset.

 

Any ideas how I could do this? I have tried to use the LASTDATE function in DAX but it doesnt seem to do what I am looking for

 

Cheers

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

you can create a measure like so:

background color =
var thiscalendardate = MAX('Calendar'[Date])
return
IF(MAX('maintenancetable'[date]) > thiscalendardate, "Red", BLANK())

Then you can use conditional formatting "background" by value on -the value/measure 

MAX('maintenancetable'[date])

Not sure if the value that represents the date in the matrix value is a measure, in this case you can use this measure instead of the MAX(...).

 

Hopefully, this is what you are looking for.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

you can create a measure like so:

background color =
var thiscalendardate = MAX('Calendar'[Date])
return
IF(MAX('maintenancetable'[date]) > thiscalendardate, "Red", BLANK())

Then you can use conditional formatting "background" by value on -the value/measure 

MAX('maintenancetable'[date])

Not sure if the value that represents the date in the matrix value is a measure, in this case you can use this measure instead of the MAX(...).

 

Hopefully, this is what you are looking for.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
ansa_naz
Continued Contributor
Continued Contributor

Hi @TomMartens

Thanks for the reply, thats brill!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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