Power Query's Max function returns the largest value in a column, and you can use it to pull the highest sale, latest date, or top score into a single cell or a summary table. The quickest route is to group your data by a category and set the aggregation to Max, but you can also add a custom column that references the maximum of another column. No add-in is needed beyond the built-in Power Query Editor in Excel or Power BI.

What You'll Need

  • Excel for Microsoft 365, Excel 2019 or later, or Power BI Desktop. Power Query is built in; older Excel versions may need the Power Query add-in.
  • A table of data loaded into Power Query (Data > From Table/Range, or Data > Get Data).
  • At least one numeric, date, or time column to evaluate. Text columns can be compared alphabetically, but that is rarely what you want.

Step-by-Step

  1. Load your data into Power Query. Select your table and go to Data > From Table/Range. The Power Query Editor opens. Menu labels can differ slightly by version and region, but the core commands are stable.
  2. Check the column type. Click the icon at the left of the column header and confirm it is Whole Number, Decimal Number, Date, or another comparable type. If it shows ABC/123, Power Query is treating it as text and Max will compare characters, not values. Change the type before continuing.
  3. Decide what you want to return. To get one overall maximum, use Group By with no grouping columns. To get a maximum per category (for example, highest sale per region), group by that category column.
  4. Open Group By. On the Home tab, click Group By. In the dialog, leave the grouping field empty if you want a single overall maximum, or add your category column (such as Region) to the grouping list.
  5. Set the aggregation. In the New column name box, type a name like MaxSales. Set Operation to Max. Set Column to the numeric or date column you want to evaluate. Click OK.
  6. Rename the result if needed. Power Query may name the output column after the operation; double-click the header to rename it.
  7. Load the result. Go to Home > Close & Load > Close & Load To and choose a worksheet location or the Data Model. The maximum value appears as a single row or as one row per category.

If you need the maximum as a value inside each row rather than a summary table, add a custom column instead: go to Add Column > Custom Column, and use a formula such as List.Max(#"Previous Step"[Sales]), replacing the step name and column with your own. This repeats the overall maximum on every row, which is useful for calculating differences from the top value.

Common Mistakes

  • Leaving the column as text. Max on text compares character codes, so "9" can rank above "10". Always set the data type first.
  • Grouping by the wrong column. If you group by a unique ID, every group has one row and the maximum is meaningless. Group only by the category you actually want to summarise.
  • Expecting Max to ignore blanks automatically. Nulls are ignored in the aggregation, but errors are not. Clean or replace errors before grouping.
  • Confusing Max with the Excel MAX function. Power Query's Max is an aggregation inside the editor; the worksheet MAX formula is separate and does not update until you refresh the query.
  • Forgetting to refresh. After changing the source data, use Data > Refresh All. The query result does not update on its own.

Tips

  • Use Max on a date column to find the most recent transaction date, which is handy for "as of" reports.
  • Combine Group By with a second aggregation, such as Sum, to see both totals and peaks side by side.
  • If you need the row that contains the maximum, not just the value, sort the column descending and use Keep Top Rows set to 1. This preserves the other columns for that record.
  • Name your steps clearly in the Applied Steps pane so formulas that reference them stay readable.
  • For per-category maximums that must appear next to each row, group to get the summary, then merge it back to the original query on the category column.

Troubleshooting

If the Max option is greyed out, the selected column is probably not a comparable type, or you are in a context where aggregation is not available. Change the data type and try again. If the result is wrong, check for text-formatted numbers, leading spaces, or mixed date formats; use Transform > Trim and change the type to fix them. If Group By returns an error, look at the Error column and use Remove Errors or Replace Errors before grouping. If the query is slow on a large table, remove unnecessary columns and filter rows before the Group By step so Power Query processes less data. If the loaded table does not match the preview, refresh the query and confirm the destination range has enough empty cells; otherwise the load can fail with a spill or overlap error.

Frequently Asked Questions

Does Power Query Max ignore blank cells?

Yes. Null values are skipped when calculating the maximum, so a column with blanks still returns the highest non-blank value. Errors, however, will break the step until they are removed or replaced.

Can I get the maximum for each category in one step?

Yes. Use Group By, add your category column to the grouping list, and set the operation to Max on the value column. The output has one row per category with its highest value.

How do I return the entire row that contains the maximum?

Sort the value column descending, then use Home > Keep Rows > Keep Top Rows and enter 1. This keeps all columns for the top record rather than just the number.

Why does Max return a text result instead of a number?

The column is typed as text. Change the type to a number or date using the icon in the column header, then reapply the aggregation.

Can I use Max inside a custom column?

Yes, with a formula such as List.Max(#"Previous Step"[ColumnName]). This returns the overall maximum and repeats it on every row, which is useful for comparisons.

Does the result update when the source data changes?

Only after you refresh. Use Data > Refresh All, or set the query to refresh when the workbook opens in the query properties.