Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
My first time with power query.
In power query I am trying to create a New column where it is only taking the max date per project ID i.e., keeping the Project ID fixed
| ID | Date | Desired_Column |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | Null | 06/04/2023 |
| 234561 | 08/03/2023 | 06/04/2023 |
| 234561 | 05/04/2023 | 06/04/2023 |
| 234561 | 06/04/2023 | 06/04/2023 |
| 234561 | 06/04/2023 | 06/04/2023 |
| 234561 | 06/04/2023 | 06/04/2023 |
Solved! Go to Solution.
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
Expand
with this result
I hope this is helpful
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
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
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
Expand
with this result
I hope this is helpful
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |