Name the top 3 customers in one line with CONCATENATEX and TOPN

Combine TOPN and CONCATENATEX to show the names of the three biggest customers, best first, in any region or category.

You will learn to

  • Use TOPN as the table inside another function
  • Sort a CONCATENATEX list by a measure
  • Explain why TOPN alone doesn’t guarantee an order

How it works

`TOPN(3, table, expression)` returns the three rows of the table with the highest value of the expression. It returns a **table**, so it can feed any function that takes one: `SUMX`, `COUNTROWS`, `CALCULATE`, or `CONCATENATEX`.

TOPN picks the rows but does **not** sort them. The rows come back in no promised order, so a list built from them needs its own sort: give `CONCATENATEX` an order expression and `DESC` to put the biggest first.

Use `VALUES(Customer[Customer])` as the table so the competition is the customers visible in the current cell: within a region, only that region’s customers.

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

Top 2 Products = CONCATENATEX(TOPN(2, VALUES(Product[Product]), [Total Quantity]), Product[Product], " & ", [Total Quantity], DESC)