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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Clampazzo
Resolver I
Resolver I

Set TImeZone to user's browser timezone in Embedded

We currently have an apps own data embedded setup of Power BI.  Our Models are currently showing all users date/times based on EST.  However, we would like to modify this so that it will adjust the timezone to reflect where the user is logged in from.  

So for instance if a user logs in from California it would set a offset of -3 on all times in the model.  

 

The model in question has a datetime dimension that is connected to the fact table.  One model is also shared across multiple clients with RLS applied to keep the data separated.  

 

What are some methods that could accomplish this?

 

I am looking into using javascript to pass the user's timezone to embedded to utilize as was mentioned in this article:  https://forum.enterprisedna.co/t/retrieve-user-timezone/69436

I can get an alert to show the timezone being used when loading the embedded report

Clampazzo_0-1732226589254.png


However, I am unsure how to capitalize on this within Power BI.  Below is the code that is used to embed the report within javascript.  

I do have a table named "TimeZone" in my model with a column named "UserTimeZone" in it

let userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(userTimeZone);
alert(userTimeZone);
var embedConfig = {
    accessToken: _selectedReport.EmbedConfig.EmbedToken.Token,
    embedUrl: _selectedReport.EmbedConfig.EmbedUrl,
    id: _selectedReport.EmbedConfig.Id,
    type: 'report',
    tokenType: models.TokenType.Embed,
    permissions: models.Permissions.ReadWrite,
    viewMode: models.ViewMode.View,
    settings: {
        panes: {
            filters: {
                expanded: false
            }
        },
        filters: [
            {
                $schema: "http://powerbi.com/product/schema#advanced",
                target: {
                    table: "TimeZone",
                    column: "UserTimeZone"
                },
                operator: "In",
                values: [userTimeZone]
            }
        ]
    }
};

 



2 REPLIES 2
GilbertQ
Super User
Super User

Hi @Clampazzo 

 

The way I have gone about this for other clients is to create multiple date columns with the daytime offset based on their location. I then have a Sliver in the report page, which will then allow them to select the time zone that they are in and all the corresponding data will then change to that time zone.





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

Proud to be a Super User!







Power BI Blog

Hi @GilbertQ , I'm looking into doing this now.  This could be a solution for my issue.  Do you happen to have an example as to how you did this?  When I attempted to do this I either get a very slow measure or something that doesn't work.  

I did create a table that I named "Timezone Offset" with just 2 columns Timezone and Offset like below

Timezone    Offset

EST                  0
CST                  -1
PST                  -3

I then created this measure to determine which one a user selects if the pull the "Timezone" field into a slicer

SelectedTimezoneOffset = 
VAR SelectedOffset = SELECTEDVALUE('Timezone Offset'[Offset], 0)
RETURN SelectedOffset


I then created this measure in my datetime table to try and allow a user to adjust the timezone on the fly... but this isn't working, visual returned a query exceeded resources error

AdjustedDateTime 2 = 
VAR Offset = [SelectedTimezoneOffset]
RETURN 
    MAX('Create DateTime'[Creation DateTime]) + Offset / 24




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors