Forum Discussion
Transform lastLogon into date in power query
- 5 years ago
Hello Anonymous
you need to devide and subtract something of the lastlogon-number in order to transform it to a DateTimeZone.
each DateTimeZone.From([lastLogon]/ 864000000000 - 109205)Here a complete example
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQxNjQ2tnTVNjRXitWB8o3M4fy80pwchIS5OYpCQwNDVL4FqkGGplgMQjbRyMTUGFkH6XwTIzS+BZp6IwLmEZLHzzc0pK55hP2L7j+S9BsamVjiiRGscWRoaGmCPTkgmU3QrFgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [lastLogon = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"lastLogon", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTimeZone.From([lastLogon]/ 864000000000 - 109205)) in #"Added Custom"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Anonymous
you need to devide and subtract something of the lastlogon-number in order to transform it to a DateTimeZone.
each DateTimeZone.From([lastLogon]/ 864000000000 - 109205)
Here a complete example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQxNjQ2tnTVNjRXitWB8o3M4fy80pwchIS5OYpCQwNDVL4FqkGGplgMQjbRyMTUGFkH6XwTIzS+BZp6IwLmEZLHzzc0pK55hP2L7j+S9BsamVjiiRGscWRoaGmCPTkgmU3QrFgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [lastLogon = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"lastLogon", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTimeZone.From([lastLogon]/ 864000000000 - 109205))
in
#"Added Custom"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
- Anonymous5 years agoNot applicable
Hey Tommy,
When I use your formula into a new custom column, it appears me an error. How can I solve this?
- Jimmy8015 years agoCommunity Champion
Hello Anonymous
add a ")" at the end
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy- Anonymous5 years agoNot applicable
All right guy! Thank you so much