Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Gcsingh149
New Member

Max date Keeping Ids Fixed

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

 

IDDateDesired_Column
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
234561Null06/04/2023
23456108/03/202306/04/2023
23456105/04/202306/04/2023
23456106/04/202306/04/2023
23456106/04/202306/04/2023
23456106/04/202306/04/2023
2 ACCEPTED SOLUTIONS
m_dekorte
Resident Rockstar
Resident Rockstar

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

m_dekorte_0-1681853470482.png

 

I hope this is helpful

View solution in original post

Anonymous
Not applicable

Hi @Gcsingh149 ,

Please try.

List.Max( Table.SelectRows( PreviousStepName, (x) => x[ID] = [ID])[Date] )

vcgaomsft_0-1681955262149.png

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Gcsingh149 ,

Please try.

List.Max( Table.SelectRows( PreviousStepName, (x) => x[ID] = [ID])[Date] )

vcgaomsft_0-1681955262149.png

 

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

m_dekorte
Resident Rockstar
Resident Rockstar

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

m_dekorte_0-1681853470482.png

 

I hope this is helpful

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors