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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Ms_2
Frequent Visitor

Query Editor Filter column based on max value (list.max)

Hello and thank you for reading.

I'm trying to filter a table in the advanced query editor based on the max value in a specific column.

 Here's the M:
~~~~

= Table.SelectRows(#"Changed Type1", each [Week by Year] = List.Max(#"Changed Type1", [Week by Year]))

~~~~

#"Changed Type1" is the previous line of code

[Week by Year] is the column i'm trying to filter.

The error looks like this:
Expression.Error: We cannot convert a value of type Table to type list.
Details:
    Value=Table

    Type=Type

This was my first attempt:

~~~

= Table.SelectRows(#"Changed Type1", each [Week by Year] = Max([Week by Year]))

~~~

Thanks for your help!

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi,

 

 

Just a slight change:

 

 

= Table.SelectRows(#"Changed Type1", each [Week by Year] = List.Max(#"Changed Type1"[Week by Year]))

List.Max requires a list (such as a Table[Column]) as its first argument.

 

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Hi,

 

 

Just a slight change:

 

 

= Table.SelectRows(#"Changed Type1", each [Week by Year] = List.Max(#"Changed Type1"[Week by Year]))

List.Max requires a list (such as a Table[Column]) as its first argument.

 

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Like this?:

 

= Table.SelectRows(#"Changed Type1", each [Week by Year] = Table[Week by Year].List.Max(#"Changed Type1", [Week by Year]))

No - just use the exact code from my post. It's the same as the code at the top of your first post with a comma removed.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.