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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Fromit
Regular 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 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 2
AlB
Community Champion
Community 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?

 

SU18_powerbi_badge

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.

 

Vijay_A_Verma
Super User
Super User

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"

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.