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
umershamshad
Frequent Visitor

Measure to display date in different colors based on specific rules.

I'm trying to create a measure which will display last refreshed date of Power BI dataset in different colors, with the following criteria:

  • Green, if last refreshed date = Today
  • Yellow, if last refreshed date = Today - 1 (Yesterday)
  • Red, if last refreshed date is before that

I've created the following measure:

 

LastRefresh =
VAR RefreshDate = MAX(LastRefreshed[LastRefreshedDate])
VAR TodayDate = MAX(LastRefreshed[Today])

RETURN
IF(
RefreshDate = TodayDate, "#00FF00",
IF(
RefreshDate = TodayDate - 1, "#FFFF00", "#FF0000"))
 
The table has only two fields:
umershamshad_0-1660201797781.png

 

This is the result I'm getting:

umershamshad_0-1660201966473.png

 

I want to display the date in  specific color instead of RGB code. Can someone help me?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User
1 REPLY 1
amitchandak
Super User
Super User

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.

Top Solution Authors