Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Guram
Regular Visitor

Show Date/time based on user's time zone

Hi all, I have a date column and I want to show it dynamically based on the user's time zone.

Guram_0-1724151752864.png

 

I changed the format of the column to date/time/timezone and I thought Power Bi would handle it automatically but it didn't work.

How can I fix this problem? (I am using Azure blob storage as the source)

Thanks for your help in advance.

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Guram 

While M has built-in functions to handle timezones, none of them automatically shifts to the user's. The service uses Utc while Desktop is the user's. M will not know what timezone those datetimes are in so any datetime column converted to datetimezone will be +0 if refreshed in the service. You can convert a datetime column to datetimezone with an offset value (like 10.5 for GMT+10:30) using DateTimeZone.AddZone but knowing what timezone to add is key. Either way, you get to select and load only a specific timezone - Utc or user-defined.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

9 REPLIES 9
Guram
Regular Visitor

Thanks for your explanation.
Is it possible to have a dropdown slicer and the user select the time zone?
Afterward, all the data is reformatted and switched to the time zone selected by the user.

Hi @Guram 

You can use a parameter where the user can select the timezone from and add that to the datetime value. Take note that the switched zone value has to be a measure as a calculated column will not recalculate in response to a slicer selection. A column that will return a distinct datetime must be added to the visual as measures do not have row context. For example, if you add category and category A has two or more datetime values then the measure will not show the correct value.  Alternatively, instead of using a slicer you can use USERPRINCIPALNAME() to return the current user's email in the service and use that to filter a predefined table of the  user email + the corresponding timezone. Please see attached pbix for the details

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @DAN,
Thank you for your solution, but I faced another issue.
I can't use measures for graph visuals, for example, the X-axis of a line chart.
Is there any way to update the time zone based on user selection in graphs alongside tables?

Hi @Guram 

Your other workaround is to crossjoin all timezones with the distinct values of your datetime columns, create a many to many relationship between the original datetime column and the crossjoined one and use the timezone from the crossjoined table in the slicer.

 

Crossjoined Table =
VAR Timezones =
    SELECTCOLUMNS ( GENERATESERIES ( -23.5, 23.5, 0.5 ), "TimeZone", [Value] )
VAR DistinctDateTimes =
    DISTINCT ( 'fact table'[datetime] )
RETURN
    CROSSJOIN ( Timezones, DistinctDateTimes )

 

Be aware while this is possible, this might negatively impact the performance of your model.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian,
Sorry for asking lots of questions, but I'm a little confused.
I couldn't set a many to many relationship here and also I don't know how to connect the time zone column with our crossjoined table.
In the demo file you sent me, I added a new graph to show the switched time zones.
Could you please help me with how I should do this?

I couldn't upload a pbix file here so here's the link to transferxl.

There's something I miss in the formula. I forgot to add the datetime based on the selected timezone. Should have been:

 

Crossjoined Table =
VAR Timezones =
    SELECTCOLUMNS ( GENERATESERIES ( -23.5, 23.5, 0.5 ), "TimeZone", [Value] )
VAR DistinctDateTimes =
    DISTINCT ( 'fact table'[datetime] )
RETURN
    ADDCOLUMNS (
        CROSSJOIN ( Timezones, DistinctDateTimes ),
        "Switched DateTime", [DateTime] + DIVIDE ( [TimeZone], 24 )
    )

 

 

danextian_0-1724762152624.png

danextian_1-1724762178328.png

danextian_2-1724762212177.png

danextian_3-1724762328669.png

 

 

Please see attached sample pbix





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian,
Thanks for your help and solutions.
I tried creating a cross-join column but got a "token Eof expected." error.

Guram_0-1724662942654.png

Could you help me with that?

It is to be done in DAX as calculated table.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
danextian
Super User
Super User

Hi @Guram 

While M has built-in functions to handle timezones, none of them automatically shifts to the user's. The service uses Utc while Desktop is the user's. M will not know what timezone those datetimes are in so any datetime column converted to datetimezone will be +0 if refreshed in the service. You can convert a datetime column to datetimezone with an offset value (like 10.5 for GMT+10:30) using DateTimeZone.AddZone but knowing what timezone to add is key. Either way, you get to select and load only a specific timezone - Utc or user-defined.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors