Reply
Highlighted
Member
Posts: 155
Registered: ‎08-25-2015

Re: last time refresh

[ Edited ]

@GilesWalker wrote:

This worked for me and takes into account that when the auto refesh on PowerBI.com occurs it is done in GMT time:

 

Enter this M formula into a blank query in the get data button:

 

= DateTimeZone.ToLocal(DateTime.AddZone(DateTime.LocalNow(),-10))

 

The -10 is becasue I am +10 GMT. Not sure why it needs to be negative but it is.

 

Hope this works.

 

Giles



Giles, 

 

Your formula was very helpful to me. However, instead of adjusting between two local timezones, I used UtcNow. 

 

= DateTimeZone.SwitchZone(DateTimeZone.UtcNow(),-5)

Member
Posts: 155
Registered: ‎08-25-2015

Re: last time refresh

Actually, that solution doesn't account for daylight savings time. Reza Rad has a comprehensive post on the problems here:

http://radacad.com/solving-dax-time-zone-issue-in-power-bi

 

Solution 3 presents two ways to get the current time from a website. The first of these ways works for me, but I'm going to try the XML version also.

Regular Visitor
Posts: 20
Registered: ‎10-25-2017

Re: last time refresh

Yes. go to top right corner of dashboard and click on three dots> go to edit details > Tick the display last refresh time.

Member
Posts: 155
Registered: ‎08-25-2015

Re: last time refresh

@cjayaneththi: on Reports or just on Dashboards?


@cjayaneththi wrote:

Yes. go to top right corner of dashboard and click on three dots> go to edit details > Tick the display last refresh time.


 

Regular Visitor
Posts: 20
Registered: ‎10-25-2017

Re: last time refresh

Just on the dashboard. 

Regular Visitor
Posts: 47
Registered: ‎08-19-2016

Re: last time refresh

Hi @KarenP

 

Which solution are you using ?

 

Regular Visitor
Posts: 47
Registered: ‎08-19-2016

Re: last time refresh

Ignore my message.

Regular Visitor
Posts: 37
Registered: ‎03-23-2016

Re: last time refresh

is there any way to kno wwhether the refresh is happening of the server of Locally? so that we can code this consistently?

Regular Visitor
Posts: 37
Registered: ‎03-23-2016

Re: last time refresh

Instead of just adding time zone Offsets (which Many suggest) ,

use the Following Power Query

 

let
    Source = #table(type table[LastRefresh=datetime], {{DateTimeZone.LocalNow()}}),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"LastRefresh", type datetimezone}}),
    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Changed Type", {{"LastRefresh", type datetimezone}}, "en-US"),
    #"Added Custom1" = Table.AddColumn(#"Changed Type with Locale", "Last Refresh Local", each DateTimeZone.SwitchZone(DateTimeZone.FixedUtcNow(),-8)),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom1",{{"Last Refresh Local", type datetimezone}})
in
    #"Changed Type1"

 

This Give two Dates, base tiime zone of the refresh and the "Local Time" I am in Pacific and just Ran this in Desktop ift Gives teh Following

 

Because we have just "Sprung Forward" to Summer time

 

Local Time.PNG

on Power BI Service it Gives the Following

Service Local Time.PNG

Visitor
Posts: 1
Registered: ‎04-22-2018

Re: last time refresh

My hack for this issue.

 

I am using SQL Database as my source. so I added another table which gets "select getdate() as LastRefreshed" . this is updated everytime the report is refreshed and will have the acurate value in GMT of what you see on last refreshed value on your dataset. making changes accordingly to the timezone solved my problem.