Rank regions by sales with RANKX and ALL on a column
Rank each sales region from best to worst with RANKX, using ALL on the Region column so every region competes.
You will learn to
- Rank the values of one column with RANKX
- Choose ALL(column) instead of ALL(table) as the list of competitors
- Read a rank in a matrix by region
How it works
RANKX compares the current cell’s value with the value of every row in the table you give it. So the first argument should hold **one row per competitor**.
Regions are not a table of their own here; they are a column of `Customer`. `ALL(Customer[Region])` returns the four distinct regions with every filter on that column removed, which is exactly the list of competitors you want.
`ALL(Customer)` is a different list: forty customers. Rank a region’s total against forty individual customers and the region wins every time, so each row shows 1.
As always, the expression is a measure so context transition evaluates it once for each region.
Practice it hands-on with a real data model and a live report that updates as you type.
Color Rank = RANKX(ALL(Product[Color]), [Total Sales])