Forum Discussion
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 every time we modify it a new version is generated, so we have the 1365 quotation with versions 1, 2 and 3, the 1366 with versions 1 and 2 and the 1367 with versions 1, 2, 3 and 4.
The only ones I am interested in selecting are the last versions of each offer, the 1365/3, 1366/2 and 1367/4, the others I want to skip them from analysis.
Can someone help me to filter and select the records I need?
Is there any instruction for this?
Thank you very much.
2 Replies
- Vijay_A_VermaMost 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" - AlBCommunity Champion
Hi Fromit
Can you share some sample data. It will the be easy to build a solution
Share it in text-tabular format so that the contents can be copied
I'm assuming you want this in Power Query? or DAX?
Please accept the solution when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.