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

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
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