Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Get Max Value from another column in a different table (Query Editor, M Code)

Is it possible to get the max value from another column in a different table in query editor?

4 Replies

    • Zubair_Muhammad's avatar
      Zubair_Muhammad
      Community Champion

      Anonymous 

       

      Try

       

      List.Max(AnotherTableName[ColumnName])

      • arpost's avatar
        arpost
        Post Prodigy

        Greetings, Zubair_Muhammad! Wanted to extend this post a bit and ask if you know how to use the List.Max to find the value that is <= to the current record's value?

        For example, if I have a table like this called Data:

        DateValue
        10/1/21100
        11/1/21200
        1/1/22100

         

        And a table like this called Commissions:

        Change DateChange %
        9/1/2110%
        12/1/2115%

         

        I want my M Query to return this in the Data table:

        DateValueChange %
        10/1/2110010%
        11/1/2120010%
        1/1/2210015%

         

        I'm assuming I need to use the List.Max in some sort of "for each" loop.

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi Anonymous ,

     

    The reply of  Zubair_Muhammad should be helpful.

     

    Have you solved your problem?

     

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If you still need help, please share some data sample and your desired output so that we can help further on it.

     

    Best Regards,

    Cherry