Forum Discussion

CoffeeTime's avatar
CoffeeTime
Frequent Visitor
6 years ago
Solved

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". 

 

 

Then I added a new custom column:

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

 

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

 

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:

 

 

Can someone help out?

  • Hi CoffeeTime ,

     

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

     

    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!

     

7 Replies

  • az38's avatar
    az38
    Community Champion

    Hi CoffeeTime 

    it's better to create a DAX calculated column

    Column = MAX(Table[NewCode])
    • CoffeeTime's avatar
      CoffeeTime
      Frequent Visitor

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

      • HotChilli's avatar
        HotChilli
        Community Champion

        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.

  • v-kelly-msft's avatar
    v-kelly-msft
    Community Support

    Hi CoffeeTime ,

     

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

     

    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!