Search code examples
powerquerym

How can I determine the records with the top N values of a column?


I have a table with a numeric column called "Count" and I want to determine the records with the top 10 values in that column. I tried using List.MaxN([Count],10) but it throws an error:

Expression.Error: We cannot convert the value 0 to type list.
Details:
  Value = 0
  Type = Type

I also tried Table.MaxN(_,[Count],10) and got an error.

What am I doing wrong and how can I get the top 10 values of the column?


Solution

  • You need to include the table name, like

    = List.MaxN(MyTable[Count],10)