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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CoffeeTime
Frequent Visitor

Power Query: List.Max dosn't return max value

I extracted a number from a code and converted it to number in column "NewCode". Then, I would like to create a column with the max value of "NewCode". 

 

image

 

Then I added a new custom column:

List.Max(#"PreviousAction"[NewCode])

 

The thing is that the returned value is not the maximum value:

 

image

Can someone help me out?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then I added a new column with the following code:

List.Max(#"Texto Extraído Entre os Delimitadores"[NewCode])

 

The thing is that the new column return a value that is not the max value:

 

image

 

Can someone help out?

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @CoffeeTime ,

 

I made a sample about using list.Max,and it worked fine.

Annotation 2020-07-17 135755.png

 

Be sure that you have changed your column type to "whole number".

 
Here is the related .pbix file.
 
 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

View solution in original post

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hi @CoffeeTime ,

 

I made a sample about using list.Max,and it worked fine.

Annotation 2020-07-17 135755.png

 

Be sure that you have changed your column type to "whole number".

 
Here is the related .pbix file.
 
 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

az38
Community Champion
Community Champion

Hi @CoffeeTime 

it's better to create a DAX calculated column

Column = MAX(Table[NewCode])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Why do you think it is better to use DAX?

But this will be used to create the table keys. Later, PBI will use it to relate different tables.

9 will be returned if the column is a text type so that's the clue.

Either something has gone wrong with the data type change or the wrong column is used in the List.Max or something else unusual.

Could you experiment by entering your own sample number column e.g. 2, 3,5 then add a column using similar code to the sample you posted and prove that works ok.

It worked. 

The origin of the data is a column with codes like 2020_XX_Y. I extracted the XX into a new column and converted it to number. Do you have a suggestion why the convertion is not working with List.Max?

Post the pbix or M code and I'll have a look

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.