cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Using slicer to change date column into user local time

I have a dataset that uses Direct Query. I have a timestamp column and I am trying to add another column that will show the local time of that column for differnt users based on the selection from the slicer (which contains the list of countries). The new column should show the timezone based on the slicer list but I am not getting the right timezone. 

 

I managed to connect to a timezonedb that will give me a list of offset for different timezones based on this article in this link: https://whitepages.tygraph.com/2020/10/dynamic-time-zone-conversion-using-power-bi/

 

This is what I have tried:

DAX measure: selected_offset = MAX(global_timezone[offset_days])
New column(local_time): date_column + [selected_offset]
 
**Start Timestamp: Timestamp column is saved using UTC+0
**selected_offset = SG timezone (UTC+8) = 0.3333
 
Desired output: 
 
Start Timestamp  selected_offset local_time
04/13/2022 2:38 0.333333333 04/13/2022 10:38
04/13/2022 2:37 0.333333333 04/13/2022 10:37
04/13/2022 2:37 0.333333333 04/13/2022 10:37
 

Please let me know how to get the correct date time for local_time column based on slicer selection. Most solutions I found offer solution in Power Query which is something I cannot use at the moment due to DQ I am using for this dataset. Thanks!

 

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

Hi @Anonymous ,

 

Please use the measure rather than calculated column.

 

local_time = MAX ( 'Table'[Start Timestamp] ) + MAX ( global_timezone[offset_days] )

vkkfmsft_0-1649992151657.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please use the measure rather than calculated column.

 

local_time = MAX ( 'Table'[Start Timestamp] ) + MAX ( global_timezone[offset_days] )

vkkfmsft_0-1649992151657.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.