Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Get max value for different column.

Dear Power Bi Community,

 

Could you please help me to to get max value for Col Max like this in power bi? I have tried several time but the max value I got is 98 for each rows, which is wrong.

 

โ€ƒ

Thank you for your assistance guys.

  • Hey Anonymous 

     

    The first solution works only if you want to select max of all columns.

     

    If you want to choose columns try this.

     

    =List.Max(Record.ToList(Record.SelectFields(_,{"Col A","Col B","Col C"}))))

     

     

    I will wait to see how this works. Accept it as a solution if this works as expected.

     

    Thanks

5 Replies

  • Hi Anonymous 

     

    For the table you have shown , you can add a custom column as below

     

    =List.Max(Record.ToList(_))

     

    Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      = Table.AddColumn(#"Replaced Value8", "Custom", each List.Max(Record.ToList([Col A],[Col B],[Col C])))

       

      i have tried already, It didnt works ๐Ÿ˜…

      • Thingsclump's avatar
        Thingsclump
        Resolver V

        Hey Anonymous 

         

        The first solution works only if you want to select max of all columns.

         

        If you want to choose columns try this.

         

        =List.Max(Record.ToList(Record.SelectFields(_,{"Col A","Col B","Col C"}))))

         

         

        I will wait to see how this works. Accept it as a solution if this works as expected.

         

        Thanks

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    You could use unpivot and pivot feature.

    Here's my solution.

    1.Add an index column

     

    2.Check Index Columns and choose unpivot other columns.

     

    3.Select the index column and then group, the operation selects all rows.

     

    4.Add a custom column to get the max value.

     

    5.The next step is to expand the columns you need.

     

    6.Select the Attribute column and pivot. Values Column selects the Value column. Selcet Don't Aggregate in the Aggregate Value Function.

     

    Results:

     

    You can check more details from my attachment.

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.