Forum Discussion
How to calculate difference between wanted date and today with filters
- 5 years ago
Hello jereaallikko
add a new column in Power Query with this formula
if _[Status]="Open" then Duration.TotalDays(Date.From(DateTime.FixedLocalNow())- [Request sent at]) else nullHere the complete example
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7JL05NUdJRMjDUAyIjA6VYnWgl/4LUPJCYiZ6BKRYxCzQxQwM9IIKKIUy00DMwBovGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Status = _t, #"Request sent at" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Status", type text}, {"Request sent at", type date}}, "de-DE"), AddDurationOfOpenRequests = Table.AddColumn ( #"Changed Type", "Duration if open", each if _[Status]="Open" then Duration.TotalDays(Date.From(DateTime.FixedLocalNow())- [Request sent at]) else null ) in AddDurationOfOpenRequestsCopy 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 jereaallikko
add a new column in Power Query with this formula
if _[Status]="Open" then Duration.TotalDays(Date.From(DateTime.FixedLocalNow())- [Request sent at]) else null
Here the complete example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7JL05NUdJRMjDUAyIjA6VYnWgl/4LUPJCYiZ6BKRYxCzQxQwM9IIKKIUy00DMwBovGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Status = _t, #"Request sent at" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Status", type text}, {"Request sent at", type date}}, "de-DE"),
AddDurationOfOpenRequests = Table.AddColumn
(
#"Changed Type",
"Duration if open",
each if _[Status]="Open" then Duration.TotalDays(Date.From(DateTime.FixedLocalNow())- [Request sent at]) else null
)
in
AddDurationOfOpenRequests
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
- jereaallikko5 years ago
Helper III