Forum Discussion
Max date Keeping Ids Fixed
- 3 years ago
Hi Gcsingh149,
Give this a go.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MTUzVNJRAiIDM10DE10jY6VYnVEJ6koYWOgaGINEcSowhYriVGBGEwWxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Date = _t, Desired_Column = _t]), ChType = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Desired_Column", type date}}), GroupRows = Table.Group(ChType, {"ID"}, {{"t", each List.Transform( [Date], (x)=> List.Max([Date])), type list}}), Expand = Table.ExpandListColumn(GroupRows, "t") in Expandwith this result
I hope this is helpful
- Anonymous3 years ago
Hi Gcsingh149 ,
Please try.List.Max( Table.SelectRows( PreviousStepName, (x) => x[ID] = [ID])[Date] )all steps.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MTUzVNJRUorVGfI8AwtdA2NdI2OEqBFI1FTXwART1Axd1JAI0VgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Date", type date}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Max Date", each List.Max( Table.SelectRows( #"Changed Type", (x) => x[ID] = [ID])[Date] )) in #"Added Custom"Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi Gcsingh149 ,
Please try.
List.Max( Table.SelectRows( PreviousStepName, (x) => x[ID] = [ID])[Date] )
all steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MTUzVNJRUorVGfI8AwtdA2NdI2OEqBFI1FTXwART1Axd1JAI0VgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Max Date", each List.Max( Table.SelectRows( #"Changed Type", (x) => x[ID] = [ID])[Date] ))
in
#"Added Custom"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum