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
HamidRezaSajad
Regular Visitor

the efficiency of my solution for extracting Max value from another table

Hello.

i'd like to know  how efficient my code is at extracting "Maximum Packing ID" from another table ([Packing_Bom]).

here is my code:

 

 

 

 

let 
ListOfPackingID =   Table.ToColumns([Packing_BOM]){10},
MaxPackingID = List.Max(ListOfPackingID),
Result = Table.SelectRows([Packing_BOM],each [PackingID] = MaxPackingID)
in 
Result

 

 

 

 

[Packing_Bom] is the right side of relation from which I want to retrive the related records. Although it works and yields required result, I care about the efficiency of it.

thank you

 

1 ACCEPTED SOLUTION
rubayatyasmin
Super User
Super User

Hi,  @HamidRezaSajad 

ListOfPackingID = Table.ToColumns([Packing_BOM]){10},

It's a pretty clever way to get just the column you need, but it's kind of like taking a scenic route to get to your favorite coffee shop when there's a shortcut. While the view is nice, it's not always the quickest way to go.

But, you can directly access the PackingId column instead of converting the entire table to columns first. 

you can try something like, 

let
PackingIDs = Table.Column([Packing_BOM], "PackingID"),
MaxPackingID = List.Max(PackingIDs),
Result = Table.SelectRows([Packing_BOM], each [PackingID] = MaxPackingID)
in
Result


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

3 REPLIES 3
rubayatyasmin
Super User
Super User

Hi,  @HamidRezaSajad 

ListOfPackingID = Table.ToColumns([Packing_BOM]){10},

It's a pretty clever way to get just the column you need, but it's kind of like taking a scenic route to get to your favorite coffee shop when there's a shortcut. While the view is nice, it's not always the quickest way to go.

But, you can directly access the PackingId column instead of converting the entire table to columns first. 

you can try something like, 

let
PackingIDs = Table.Column([Packing_BOM], "PackingID"),
MaxPackingID = List.Max(PackingIDs),
Result = Table.SelectRows([Packing_BOM], each [PackingID] = MaxPackingID)
in
Result


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


hello and thanks for your respons. yes you right. as you said, it could be much bettert off if i use Table.Column instead of Table.ToColumn.

there is always a bettwer way.

thank you

Happy to help


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


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.

Top Kudoed Authors