Power BI Refresh Date/Time
From today's Power BI User Group, I saw @Rebecca Sundquist using Power Query's M code of get local time to get a table of last refreshed date/time for the Power BI. I remember there was reason why I didn't do that, and can't remember.
Now, I remember, so I want to put this out here so others can be aware, as well as for myself to remember why I had to do something more complex. @Erik Leaver maybe somehow post this along with the recording for others to see?
Using DateTime.LocalNow() only “works” while you are on Power BI Desktop, as the Desktop knowns your local time zone. When published to the Power BI Service, it operates in UTC time.
Another method is to do timezone hours adjustment, that works well IF you are at a location that doesn't have daylight savings, otherwise, every time daylight savings change, you have to account for the +1 and -1. So that's not workable for me.
Instead I use a web service that will give me the date/time I need for the timezone and it auto accounts for daylight savings: https://worldtimeapi.org/api/timezone/America/New_York
Below is the Power Query M-code for doing this.
let
Source = Json.Document(Web.Contents("https://worldtimeapi.org/api/timezone/America/New_York")),
#"Converted to Table" = Table.FromRecords({Source}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"abbreviation", type text}, {"client_ip", type text}, {"datetime", type datetimezone}, {"day_of_week", Int64.Type}, {"day_of_year", Int64.Type}, {"dst", type logical}, {"dst_from", type datetime}, {"dst_offset", Int64.Type}, {"dst_until", type datetime}, {"raw_offset", Int64.Type}, {"timezone", type text}, {"unixtime", Int64.Type}, {"utc_datetime", type datetime}, {"utc_offset", type duration}, {"week_number", Int64.Type}})
in
#"Changed Type"
Comments
-
@Alex Wong, you are right! I thought the Service used the time zone for the tenant's location, but I was wrong. I tested, and Power BI Service is using UTC as documented: DateTime.LocalNow - PowerQuery M | Microsoft Learn.
Thank you for sharing your solution that works with daylight savings! The worldtimeapi is simpler than the custom function I found here: How-To: Convert UTC to Your Local Time Zone in Pow... - Microsoft Fabric Community.
Unfortunately, I cannot access the worldtimeapi from my work laptop, though it works for me from my phone. It must be blocked by my organization. If only it were simple!
1 -
@Rebecca Sundquist
WorldTimeAPI has been failing for me lately and when looking into their website, while it is simple quick and useful, there is no reliability guarantee.Thinking back at what else I can do, I found a more self sustaining path: make your own web API.
Power Automate flow using HTTP trigger can be used for this, very simple and effective, ONE trigger and ONE action flow.

The datetime property to return has this expression: convertFromUtc(utcNow(), 'Eastern Standard Time'). The “Eastern Standard Time” timezone auto-corrects with daylight savings (UTC-4 or UTC-5).
I also added a timezone and abbreviation property, though really not needed, but gives the datetime a little more “context”.
In Power BI:
1 -
@Rebecca Sundquist
added 2 more good properties (using Compose to convert to ET first so 1 more action):
convertFromUtc(utcNow(), 'Eastern Standard Time') 
Body:
{
"datetime": "@{outputs('Compose_DateTime_Converted_ET')}",
"day_of_week": @{dayOfWeek(outputs('Compose_DateTime_Converted_ET'))},
"day_of_year": @{dayOfYear(outputs('Compose_DateTime_Converted_ET'))},
"timezone": "Eastern Standard Time",
"abbreviation": "ET"
}Schema:
{
"type": "object",
"properties": {
"datetime": {
"type": "string"
},
"day_of_week": {
"type": "integer"
},
"day_of_year": {
"type": "integer"
},
"timezone": {
"type": "string"
},
"abbreviation": {
"type": "string"
}
}
}
1
Categories
- All Categories
- 6 Blackbaud Community Help
- 206 bbcon®
- 1.4K Blackbaud Altru®
- 394 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 357 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 646 Blackbaud Grantmaking™
- 561 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 934 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.4K Blackbaud Raiser's Edge NXT®
- 3.6K SKY Developer
- 242 ResearchPoint™
- 118 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 238 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 28 PowerUp Challenges
- 3 (Open) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 778 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
