Sales from the top 10% of customers with PERCENTILEX.INC
Find the spend that puts a customer in the top 10% with PERCENTILEX.INC, then add up the sales of everyone above that line.
You will learn to
- Calculate a percentile threshold across customers
- Capture the threshold in a variable before filtering
- Sum the sales of the customers above the threshold
How it works
“Top 10 customers” depends on how many customers you have. “Top **10%** of customers” scales: in a region of 10 customers it is the best one, across 40 it is the best four.
`PERCENTILEX.INC(table, expression, k)` evaluates the expression for each row and returns the value at percentile `k` (between 0 and 1). With `VALUES(Customer[Customer])`, `[Total Sales]` and `0.9`, it is the spend that 90% of the buying customers stay below: the entry ticket to the top 10%. Like the other X functions, it skips customers with no sales.
Work it out **once**, in a variable, in the report’s context. Then keep the customers whose sales reach it with `FILTER(VALUES(Customer[Customer]), [Total Sales] >= …)`, and use that table as a CALCULATE filter.
Practice it hands-on with a real data model and a live report that updates as you type.
Products Above the Median =
VAR Middle = MEDIANX(VALUES(Product[Product]), [Total Sales])
RETURN COUNTROWS(FILTER(VALUES(Product[Product]), [Total Sales] > Middle))