Show the top customer’s name with TOPN and MAXX

Return the name of the best customer in each region, not just a number, by combining TOPN(1, …) with MAXX.

You will learn to

  • Find the single best row with TOPN(1, …)
  • Return a text column from a one-row table with MAXX
  • Keep the contest inside the current filter

How it works

Sometimes the answer you want is a **name**: who is our best customer in the North? A measure can return text as well as numbers.

`TOPN(1, Customer, [Total Sales])` returns a one-row table: the customer with the highest sales in the current cell. It is a table, though, and a measure must return a single value.

To pull one column out of that row, iterate it with `MAXX(table, Customer[Customer])`. With only one row, the “largest” value is simply that row’s name. MAXX works on text too, comparing alphabetically.

Use `Customer` rather than `ALL(Customer)` so each region (or year, or category) finds its own winner.

Practice it hands-on with a real data model and a live report that updates as you type.

Top Product = MAXX(TOPN(1, Product, [Total Sales]), Product[Product])