Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Good day all,
Currently i'm working on creating a measure for net throughput time between two timestamps, where i will eventually cut out the outside business hours and weekends / holidays and i'm planning to do all of this within Query M. (Yes i set a challenge, if i am to read other posts about determining workdays in QueryM).
But lets focus on something a little more easy. My question:
Is there a more clean code than the double conversion i have to make in the following?:
Solved! Go to Solution.
Hi @decarsul ,
Would you accept this as a cleaner way?
Date.From([Datetime created]) & Time.From("08:00:00")
Not sure if it is relevant or not, but please see this post and the example M code on calculating working minutes between two datetimes.
Calculate Hours with taking into account Business ... - Microsoft Power BI Community
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @decarsul ,
Would you accept this as a cleaner way?
Date.From([Datetime created]) & Time.From("08:00:00")
Hi @Payeras_BI ,
It prevents a double conversion, so it is clearner for sure!
Wonder if there's more ways.
You could try
end_time - max(start_time,8)
let
Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrcyNrAyMFDSUTI0tzI0VYrViVYysACyoIJmViYQQQsrA0OgWpAYkAnWAxI2B8kja7ZAMS0WAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [st = _t, et = _t]),
#"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"st", type time}, {"et", type time}}),
#"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "nt", each Duration.TotalSeconds([et]-List.Max({[st],#time(8,0,0)})))
in
#"Aggiunta colonna personalizzata"
I would be curious to know what kind of company is the one that counts the working time up to the second. Maybe it's a watch factory? 😁
On Topic: Interesting approach, but i don't think ill use that bit.
Off topic:
Haha, you really got a point there, but i'm geussing the answer is: a company who wants to overuse their compute resources 😛
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
35 | |
17 | |
12 | |
11 | |
9 |
User | Count |
---|---|
44 | |
27 | |
16 | |
14 | |
13 |