Forum Discussion
Date Difference Not Working
- 8 years ago
Well, in Power Query you should get a result back of I believe Days:Hours:Minutes:Seconds. This all works for me here:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQsLAyMAAiBUdfJR2EqCVCNFaHGNVGJKk2sTKFqI4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type datetime}, {"Column2", type datetime}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Column2]-[Column1]) in #"Added Custom"But, my stuff is all in US. Now, when this gets to DAX I end up getting values like 0.0461666666, 0.043055555, 0.450231481... which is exactly what I get if I do a ([Column2]-[Column1])*1.0 in DAX. There are ways to convert this to something useful but DATEDIFF is going to be your safest bet.
Hi Greg,
The image shows me adding a Custom Column in Edit Quieries.
But I have attempted to add column in DAX with also no joy.
Kind regards,
Gary
Well, in Power Query you should get a result back of I believe Days:Hours:Minutes:Seconds. This all works for me here:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMLRQsLAyMAAiBUdfJR2EqCVCNFaHGNVGJKk2sTKFqI4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type datetime}, {"Column2", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Column2]-[Column1])
in
#"Added Custom"But, my stuff is all in US. Now, when this gets to DAX I end up getting values like 0.0461666666, 0.043055555, 0.450231481... which is exactly what I get if I do a ([Column2]-[Column1])*1.0 in DAX. There are ways to convert this to something useful but DATEDIFF is going to be your safest bet.