Biggest customer’s share with ADDCOLUMNS, MAXX and SUMX

Add a sales column to a list of customers with ADDCOLUMNS, then read its largest value and its total to measure customer concentration.

You will learn to

  • Add a calculated column to a virtual table with ADDCOLUMNS
  • Aggregate a virtual column with MAXX and SUMX
  • Explain why the new column needs a measure, not SUM

How it works

`ADDCOLUMNS(table, "Name", expression)` returns the table with one or more extra columns. `ADDCOLUMNS(VALUES(Customer[Customer]), "Customer Sales", [Total Sales])` gives you a little two-column table: each visible customer and that customer’s sales.

The expression runs once per row, in **row context**. A measure like `[Total Sales]` turns that row into a filter (context transition), so each customer gets their own number. A bare `SUM(Sales[Amount])` would not: every row would get the same total.

Store the table in a variable and you can read the new column as often as you like with iterators: `MAXX(t, [Customer Sales])`, `SUMX(t, [Customer Sales])`, `AVERAGEX(t, [Customer Sales])`. A virtual column is referenced by its name alone, in square brackets, and it can’t share a name with a measure.

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

Weakest Month Units =
VAR Months = ADDCOLUMNS(VALUES('Date'[Month Year]), "Units", [Total Quantity])
RETURN MINX(Months, [Units])