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
Anonymous
Not applicable

Conditionnal formatting of last refresh date

Hello everyone,

 

I have my last refresh date that show up in a card visual. I would like to conditional format it so it show in red if it is older than 2 hours.

Do you guys know how to do that ? I searched for a bit but it seems nobody ever needed this, or it is so simple nobody ever asked.

 

Thanks in advance,

James

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi @Anonymous ,

 

Here are the steps you can follow:

1. Get "Last Refreshed Date" via the following link”.

How to Show Last Refresh Date in Power BI / Blogs / Perficient

vyangliumsft_0-1676879427431.png

2. Create measure.

Now = NOW()
Last Refreshed Date =
MAX('Last Refreshed Date'[Column1])
Color =
var _datediffminute=
DATEDIFF(
    [Last Refreshed Date],[Now],MINUTE)
var _2hour=
60 * 2
return
IF(
    _datediffminute>_2hour,"red","green")

3. Visualizations – Callout value – FX.

vyangliumsft_1-1676879427432.png

 

vyangliumsft_2-1676879427433.png

4. Result:

vyangliumsft_3-1676879427434.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi @Anonymous ,

 

Here are the steps you can follow:

1. Get "Last Refreshed Date" via the following link”.

How to Show Last Refresh Date in Power BI / Blogs / Perficient

vyangliumsft_0-1676879427431.png

2. Create measure.

Now = NOW()
Last Refreshed Date =
MAX('Last Refreshed Date'[Column1])
Color =
var _datediffminute=
DATEDIFF(
    [Last Refreshed Date],[Now],MINUTE)
var _2hour=
60 * 2
return
IF(
    _datediffminute>_2hour,"red","green")

3. Visualizations – Callout value – FX.

vyangliumsft_1-1676879427432.png

 

vyangliumsft_2-1676879427433.png

4. Result:

vyangliumsft_3-1676879427434.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

AilleryO
Memorable Member
Memorable Member

Hi,

 

My first idea, would be to create a Mesure to calculate the difference between now and that date-time refresh, and to check if it more than 2 hours.

Example :

MesureTest =

VAR DateToday=
    TODAY ()
RETURN
    IF ( LASTDATE ( TableDate[Date] ) < DateToday, 1, 0 )

Then you cas use this Mesure for conditionnal formatting.

Using Rules and if your test mesure = 0 (or 1) then choose color.

 

Let us know if it works 

Anonymous
Not applicable

That's what I considered first too. But I can't use my Last refresh table in a dax formula. I can't figure why.

James_C_0-1676619290666.png

James_C_1-1676619301567.png

 

It is actualized by a query that marks it =NOW() so it updates everytime the dataset is refreshed.

Any idea why, or how I could sove this ?

 

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