Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query List.Average: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

List.Average in Power Query takes a list of numbers and returns their arithmetic mean; you can use it in a custom column, a query step, or a small helper query. It ignores null values, so a list containing 5, null, and 15 averages to 10, not 6.67. To use it, you need Power Query in Excel (Data > Get & Transform Data) or Power BI Desktop (Transform Data), a table or list of numeric values, and a basic understanding of the formula bar. The function is not available through the ribbon menus; you type it into the formula bar or the Advanced Editor.

What You'll Need

  • Excel 2016 or later, Microsoft 365, or Power BI Desktop. Power Query is built in; no add-in is required.
  • A table or list of numeric values loaded into Power Query. The column should be data type Number or Decimal Number, not Text.
  • Access to the formula bar (View > Formula Bar) or the Advanced Editor (Home > Advanced Editor). Menu labels can differ slightly by version and region.

Step-by-Step

  1. Load your data into Power Query. In Excel, select your table and go to Data > From Table/Range. In Power BI Desktop, use Home > Transform Data to open the Power Query Editor with your query selected.
  2. Check the column data type. Select the numeric column, then on the Home tab use Data Type and choose Decimal Number or Whole Number. If the type is Text, List.Average will fail with an error because it only works on numbers.
  3. Decide where the average should appear. You have three practical options: a custom column that repeats the average on every row, a single value returned by a helper query, or a step inside an existing query that you reference elsewhere.
  4. Open the formula bar. Go to View and tick Formula Bar. Click the fx icon to the left of the formula bar to start a new step.
  5. Write the List.Average expression. The basic pattern is = List.Average(Source[ColumnName]), where Source is your previous step name and ColumnName is the numeric column. For example, = List.Average(#"Changed Type"[Sales]) returns the mean of the Sales column.
  6. Rename the step. Right-click the new step in the Applied Steps pane and choose Rename so the name is meaningful, such as Average Sales. This makes later references easier to read.
  7. Use it in a custom column if you want a row-level value. Go to Add Column > Custom Column, enter a name such as Average Sales, and in the formula box type List.Average(#"Changed Type"[Sales]). Every row will show the same average, which is useful for comparisons such as above/below average.
  8. Create a single-value helper query if you need the average elsewhere. Right-click your query in the Queries pane and choose Reference. Remove all columns except the one you want to average, then add a step with = List.Average(#"Removed Other Columns"[Sales]). Rename the query to something like AvgSales. You can then merge or reference this single value in other queries.
  9. Handle nulls deliberately. List.Average skips nulls automatically. If you want nulls treated as zero, replace them first with Table.ReplaceValue or by using the Replace Values command on the column before averaging.
  10. Close and load. In Excel, use Home > Close & Load to send the result to a worksheet or the Data Model. In Power BI Desktop, use Home > Close & Apply.

Common Mistakes

  • Passing a table instead of a list. List.Average expects a list. If you write List.Average(Source) where Source is a table, you get an error. Use the column reference form Source[ColumnName].
  • Leaving the column as Text. Numbers stored as text cause an error or an unexpected result. Set the data type to Decimal Number before averaging.
  • Forgetting the step name. The step name in brackets must match the previous step exactly, including spaces and special characters. Power Query wraps names with spaces in #"..."; keep that formatting.
  • Assuming nulls count as zero. They do not. If your business rule treats blanks as zero, replace them first.
  • Using List.Average on a column with errors. Any error value in the list makes the whole expression fail. Remove or replace errors before averaging.

Tips

  • Use List.Average together with List.Sum and List.Count when you need to show the calculation or handle special cases.
  • If you need the average of a filtered subset, apply the filter step before the List.Average step. The function only sees the rows present at that point in the query.
  • For a quick check, use the Column Profile and Column Quality options under the View tab to see the average before you write any formula.
  • Name your steps clearly. A step called Average Sales is far easier to debug six months later than Custom1.
  • If you are averaging a column that contains very large or very small numbers, confirm the data type is Decimal Number rather than Whole Number to avoid rounding surprises.

Troubleshooting

If List.Average returns an error, work through these checks in order. First, confirm the column data type is numeric. Second, check for error values in the column and remove them with Remove Errors on the Home tab. Third, verify the step name in your formula matches the Applied Steps pane exactly. Fourth, confirm you are passing a list, not a table. If the result looks wrong, check whether nulls are present and decide whether they should be treated as zero. If the function is unavailable in the formula bar, make sure you are in the Power Query Editor, not the worksheet. If a custom column shows the same value on every row, that is expected: List.Average returns a single number, not a row-by-row calculation. If you need a row-by-row average of several columns, use the Add Column > Average command or write an arithmetic expression instead.

Frequently Asked Questions

Does List.Average ignore null values?

Yes. Nulls are skipped, so the average is calculated only from the non-null numbers in the list.

Can I use List.Average on a column that contains text?

No. The column must be a numeric data type. Change the type to Decimal Number or Whole Number first.

What is the difference between List.Average and the Average option in the ribbon?

The ribbon's Average command creates a step for you. List.Average is the underlying function you can type manually, which is useful inside custom columns and helper queries.

Why does my custom column show the same number on every row?

Because List.Average returns one value for the whole column. To compare each row to that average, keep the custom column and add a second column that subtracts the row value from the average.

Can I average a filtered list?

Yes. Apply the filter step before the List.Average step; the function only evaluates the rows that remain at that point.

Does List.Average work in Power BI Desktop and Excel the same way?

Yes. The function is part of the Power Query engine used by both, so the syntax is identical. Menu locations differ slightly between the two applications.