Forum Discussion

Don-Bot's avatar
Don-Bot
Helper V
1 year ago

Apply TimeZone offset from offset table to datetime table with snowflake schema

I have a Snowflake Schema setup where I have a main Ticket table which is connected to a DateTime table.  Then in order for me to see what timezone the records are in I need to connect to a Call Center Table which is then connected to the TimeZone offset table.  How can I set this up so that I can apply the appropriate timezone offset to the datetime table?

 

I've tried creating calculated columns that work with these but everything I try fails.  

 


EDIT:  

I have tried different methods  to achieve this with some success in finding a work around but none in auto assigning a timezone.  Below is an update I put as a reply in this post.  I've modified my original ask as well.

I am working with a Apps Own Data embedded setup for Power BI.  The semantic model is an import model coming from databricks.  

 

The model is also now setup as  a star schema.  

 

Below is some fake data.  The data comes into our system as EST.  I would like to be able to pass the timezone offset from javascript via embedded and auto setup the timezone the user sees.  

I have tried the following measures with no success (as they keep timing out).  A user may create a table visual with thousands of rows in it with their datetimes laid out in it. 

 

I hardcoded the -3 below just to try to convert to PST from EST.

 

 

AdjustedCreateDateTime = 
    CALCULATE(
        MAX('CreateDateTime'[CreateDateTime]) + -3/ 24
    )


Fact Table

TicketIDCreateDateTimeIDItemCount
a2205541
b2207461
c2207471
d2207481
e2207491
f2207501
g2207511
h2207521
i2207531
j2207541
k2207551
l2207561
,2207571
m2207581
o2207591
p2207601
q2207611
r2207621
s2207631
tt2207561
u2207571
v2207581
ww2207591
sx2207601
df2207611
sdf2207621
sdfa2207631

 

 

CreateDateTime

DateTimeIDDateIDDateTIME
22102392541/2/2024 13:00
22074692371/1/2024 0:00
22074792371/1/2024 1:00
22074892371/1/2024 2:00
22074992371/1/2024 3:00
22075092371/1/2024 4:00
22075192371/1/2024 5:00
22075292371/1/2024 6:00
22075392371/1/2024 7:00
22075492371/1/2024 8:00
22075592371/1/2024 9:00
22075692371/1/2024 10:00
22075792371/1/2024 11:00
22075892371/1/2024 12:00
22075992371/1/2024 13:00
22076092371/1/2024 14:00
22076192371/1/2024 15:00
22076292371/1/2024 16:00
22076392371/1/2024 17:00
22076492371/1/2024 18:00
22076592371/1/2024 19:00
22076692371/1/2024 20:00
22076792371/1/2024 21:00
22076892371/1/2024 22:00

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Don-Bot Well, you can either make your Tickets to Call Center and Call Center to Timezone Offset relationships Both directions or you can use LOOKUPVALUE or MAXX( FILTER( ... ), ... ) to lookup your values. Lookup the Call Center from and then lookup the Timezone offset.

    • Don-Bot's avatar
      Don-Bot
      Helper V

      Thanks Greg_Deckler ,
      I have tried adding the below LookupValue as a measure in the DateTime table but I get the error The column 'One Call Center[Timezone]' either doesn't exist or doesn't have a relationship to any table available in the current context.

       

      Placing this measure in the CreateDate table gives a Query has exceeded the available resources error as well

      Also, I don't care for the "Max" in the query below so will look into how to replace that

      TimezoneOffset test =

       LOOKUPVALUE(
          'TimeZone Offset'[Offset],
          'TimeZone Offset'[TimeZone],
          MAX('One Call Center'[TimeZone])
      )



       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Don-Bot I'm not sure that you can use RELATED since they are not related ( your relationship direction is not the right direction from what I can tell ). Sample data would really help to arrive at a solution here.