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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

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

@Anonymous , Use the measure last refresh in the table and color measure in conditional formatting using the field value option.

 

refer

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/1682539
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pane-66e0afcb15f3

 

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

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Use the measure last refresh in the table and color measure in conditional formatting using the field value option.

 

refer

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/1682539
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pane-66e0afcb15f3

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors