Forum Discussion
Fromit
4 years agoRegular Visitor
Selecting the last version
Good morning. I have a database with the issued offers, the keys of the records consist of the offer number and the version of the offer. Every time we generate an quotation it creates a record and...
Vijay_A_Verma
4 years agoMost Valuable Professional
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XY6xDcAgDAR3cU0DNo9TJmsg9l8DozgRuPgvXqeze6fMqJQoW1isbhrpX4tF1er5VjgrFTsMh0UizBZoZBcm573mZiCuS9x2b3OvXsdv6oZcXsOY", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Quotation = _t, Version = _t, #"Time Taken" = _t, Location = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Quotation", Int64.Type}, {"Version", Int64.Type}}),
BuffZipList = List.Zip({#"Changed Type"[Quotation],#"Changed Type"[Version]}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Max(List.Transform(List.Select(BuffZipList, (x)=>x{0}=[Quotation]), each _{1}))=[Version]),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"})
in
#"Removed Columns"