Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello,
I use this function to work against the utc+2 time lap:
Time.Hour(DateTimeZone.SwitchZone(DateTimeZone.LocalNow(),2,0))
I have different calculation based on different times.
I wanted to get the right day as well. For example when its already 1am the server is still 23:00.
And so I need a function which not tells me the time.hour but the day whe are in, including the time lap of course.
When I do the following I always get year 1899:
Date.From(DateTimeZone.SwitchZone(DateTimeZone.LocalNow(),2,0))
Is there a workaround to get the "right" day from client point of view?
Thank you in advance.
Best.
Solved! Go to Solution.
Hi @Applicable88 ,
Use below M code to get the right day:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ31TcyUDA0sDIyc/RVio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Datetime = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Datetime", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTimeZone.SwitchZone(DateTimeZone.From(DateTime.LocalNow()),2,0)),
in
#"Added Custom"
DateTimeZone.SwitchZone(DateTimeZone.From(DateTime.LocalNow()),2,0)
pls check my .pbix file attahched.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @Applicable88 ,
Use below M code to get the right day:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ31TcyUDA0sDIyc/RVio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Datetime = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Datetime", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTimeZone.SwitchZone(DateTimeZone.From(DateTime.LocalNow()),2,0)),
in
#"Added Custom"
DateTimeZone.SwitchZone(DateTimeZone.From(DateTime.LocalNow()),2,0)
pls check my .pbix file attahched.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |