max function in power query

  • Metadata

    • topic:: 00 Coding00 Coding
      #MOC / for programming language, coding guide and libraries focusing on data analytics and html/css
      • related:: 01 Power Query01 Power Query
        #MOC / for notes sub to 00 Coding with focus on how I use Power Query
        , Power BI Private or Broken Links
        The page you're looking for is either not available or private!
    • updated:: 2022-06-21 Private or Broken Links
      The page you're looking for is either not available or private!
    • reviewed:: 2022-06-21 Private or Broken Links
      The page you're looking for is either not available or private!
    • #PersonalNote #CodeNote
  • I can use List.Max to find a max of two values (or a custom array), especially for using max of 0 or the @column (active row for the column)

    • use curly braces to encapsulate the values to compare i.e. List.Max({[0, @column]})
    • this is based on MS Docs’s example and worked in my test
        List.Max({1, 4, 7, 3, -2, 5}, 1)
      
    • syntax help
        List.Max(**list** as list, optional **default** as any, optional **comparisonCriteria** as any, optional **includeNulls** as nullable logical) as any
      

References

  • [List.Max - PowerQuery M Microsoft Docs](https://docs.microsoft.com/en-us/powerquery-m/list-max)