Skip to main content

Power BI

Needs Votes

Allow formatting datetimezone fields to user local timezone

Vote (404) Share
Christiaan B.'s profile image

Christiaan B. on 29 Aug 2017 05:15:12

Typically date & time information is available in UTC (if not then put it to UTC at source), you just want it rendered in the users' locale/time zone at reporting time.

Adding an option to format datetimezone fields in the users' locale/time zone (based on the user account settings) would probably solve 90+% of requirements for rendering time zone information.

Currently MS does not provide for showing offset information (or local time zone) as you only have date/time format options, but in the query editor you can set type to datetimezone which show offset info so it's clearly available - just the rendering that lacks.

Not having this functionality is forcing people to resort to hacks like using DateTimeZone.AddZone () with hardcoded time offsets - not scalable where DST is involved. Current workarounds obviously only work as long as the viewer is in the designated time zone and does not scale across a global audience.

Comments (33)
Christiaan B.'s profile image Profile Picture

7222f29f 9032-4bf8-875e-067bfb17b2b8 on 05 Jul 2020 23:41:46

RE: Allow formatting datetimezone fields to user local timezone

'So much needed, especially as not all countries flip to DST on the same date in the year.
E.g. we receive data from a server located in Seattle. So the timezone of the data is Pacific Standard Time (PST = GMT -8) until 10 Mar 2019. Then it switches to Pacific Daylight Time (PDT = GMT-7) until 3 Nov 2019, to then switch back to PST.
To make it worse, e.g. users in the UK switch to British Summer time (BST = GMT+1) on 31-Mar-2019 and flip back on 27-Oct-2019 (GMT+0). So most of the time we are 8 hours apart, but late March / early April and late October / early November it gets very tricky.
And if you think this is not complex enough, Europe is already discussing to permanently scrap DST in the EU soon. So even if you build your own query logic with hard coded dates when DST starts/stops by country, you can rework this logic again in every model when things change.

Thus offering a solution to 'select a timezone' will only work if combined with selecting whether 'DST is enabled or not' in that timezone. Also, when converting from one timezone to another, the DST flag must be available for both the source and the target value separately.

So I like the idea of Eric Thomas for a simple text string conversion, but would add another (optional) DST parameter.

##############
How about an option to SELECT THE TIMEZONE and DST ENABLES when converting a UTC Text Column to DATE-TIME?

- Right click column
- Select Date-Time
- Choose Timezone (i.e. for GMT-8 for Pacific Time, so always use the 'standard' time)
- Choose DST Enabled (True/False, this shall adjust GMT offset by -1/0/+1 based on current date)
- Click Apply
- Time is converted correctly!
#################

And to make it really generic, I suggest to add an optional DST parameter to all the DateTimeZone () functions. Or even add a new set of DateTimeZoneDST () to the M language with the extra DST flag. In fact there must be two DST flags added, one for DST source, and one for DST target, i.e. is DST enabled

Christiaan B.'s profile image Profile Picture

5972bb82 5192-e711-8103-c4346bac219c on 05 Jul 2020 23:37:25

RE: Allow formatting datetimezone fields to user local timezone

YES, PLEASE! How is it that power BI is not able to render results in the user's local time zone, given that nearly every we platform on earth stores data in UTC and presents it in the user's local time zone?

Christiaan B.'s profile image Profile Picture

2433f1cb 7239-ea11-a813-000d3a579c33 on 05 Jul 2020 23:33:21

RE: Allow formatting datetimezone fields to user local timezone

'How about an option to SELECT THE TIMEZONE when converting a UTC Text Column to DATE-TIME?
- Right click column
- Select Date-Time
- Choose Timezone
- Click Apply
- Time is converted correctly!

Christiaan B.'s profile image Profile Picture

d3dbe640 b502-49be-8acf-4eb9eab253d7 on 05 Jul 2020 23:31:43

RE: Allow formatting datetimezone fields to user local timezone

I am playing around with importing data from JSON files and am tangling with trying to convert JSON Date/Time to something that I can work with. This could be a lot easier couldn't time? TZ seems to be something that is always such a pain - can you help me not shoot myself in the foot.....repeatedly?

Christiaan B.'s profile image Profile Picture

7d0c8c5b 4cea-4ce3-bed2-5cccad269c9a on 05 Jul 2020 23:31:05

RE: Allow formatting datetimezone fields to user local timezone

Please fix this! Just spent quite a few hours trying to figure out why 30/09/2018 is showing as 29/09/2018 due to daylight savings change in New Zealand.

Christiaan B.'s profile image Profile Picture

3f661fc5 2bcd-4d6d-8788-c855ac2eece0 on 05 Jul 2020 23:29:15

RE: Allow formatting datetimezone fields to user local timezone

I need to show in a Powe BI report the last refresh date/time of the data.
I keep the date of recharged in a table with a single row and a single column.
But this is the UTC time.
Now I return the one from Spain, but I would like to be able to return the local time of every user.

I think that Power BI should have a function to get the time zone of the current user who is using the Power BI service.

Christiaan B.'s profile image Profile Picture

849602a8 a625-454a-9b36-eec2c498b3f9 on 05 Jul 2020 23:28:39

RE: Allow formatting datetimezone fields to user local timezone

Hi,

Please try DateTimeZone.RemoveZone(DateTimeZone.ToLocal(DateTime.AddZone([#"Date_UTC"],0)))

Hope it helps !

Christiaan B.'s profile image Profile Picture

7c77544b 776f-4828-b5de-b81e1a15050d on 05 Jul 2020 23:27:47

RE: Allow formatting datetimezone fields to user local timezone

This would make my life soooo much easier.

Christiaan B.'s profile image Profile Picture

ef6444c5 7184-4abc-9415-6e3f4292a047 on 05 Jul 2020 23:26:20

RE: Allow formatting datetimezone fields to user local timezone

Aggreed on this one. All my data is in UTC but when reporting, everything needs to be at local time

Christiaan B.'s profile image Profile Picture

3101328d e4e2-4d82-a3ff-9aefdd878e1e on 05 Jul 2020 23:24:57

RE: Allow formatting datetimezone fields to user local timezone

Yep, I wish I could do at least one of the following...

1. Take my date/time values stored in the data model (e.g. in UTC), and create a DAX measures to return the date/time in the Power BI Service user's local time zone. (And, another DAX measure to say what the user's local time zone is.)

2. Store date/time/timezone values in the data model ... and, have a way for the Power BI Service to convert those values, in reports, to the user's local time zone.