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
Shard
New Member

Moving date depending on time (GMT to GMT-7)

Hi,

 

So the exciting issue i have is that we download sales data from a system based in Arazona but operate in the UK, the team who want the reports are based in Arazona so want the daily / weekly sales etc based on their time but our sales agents work GMT so up to 3am.

 

Their reporting system (because well bad programming not my job unfortunatly) even if you are in Arazona exports the forms in GMT whcih means any sales done in the uk at 3am are represented as 3am that day not 8pm MST and so skew the results.

 

I'm trying to wrack my brain on how to use data transform to shift the date (and time) depending on the time in the time column so that the sales are represented for the correct date (if that makes sense), I've tried a couple of IF statments but ended up just making a bit of a mess if im honest and it was all bad, I also though "ah ill just shift my computer time to export the file" but no that didnt work either as i thought their system was using system time to export for the right timeszone but it turns out that it jsut exports in GMT even though its based in AZ and hey want the reports in MST..... so who knows whats going on with  that

 

Hoping some of you smarter people can assist me / point me in the right direction, a lot of the reporting forumulas all use varios iterations of the today function so ideally i want to manipulate the data in the transform editor to make life just better.

 

Shard_0-1709215964501.png

 

Many thankings

 

2 REPLIES 2
dufoq3
Super User
Super User

Hi @Shard, what about this?

 

Result:

dufoq3_0-1709232862556.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrLQNzDSNzIwMlHSUTIysjI0VYrVQRM2MLYyMMAUNjQCC8cCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Purchase Date (UTC)" = _t, #"Purchase Time" = _t]),
    #"Ad_PurchaseDateTimeUtc-7" = 
          Table.AddColumn(Source, "Purchase DateTime (UTC-7)", each DateTime.From(
               DateTime.AddZone(
                    Date.From([#"Purchase Date (UTC)"], "en-GB") & Time.From([Purchase Time], "en-GB"),
                    8
               )
          ), type datetime
     )
in
    #"Ad_PurchaseDateTimeUtc-7"

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Shard
New Member

All sorted, after much fiddling I manged to sort it out 🙂

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
Top Kudoed Authors