Rank with ties: DENSE vs SKIP in RANKX
Rank customers by number of orders, where many are tied, and choose whether the next rank after a tie skips numbers or carries on.
You will learn to
- Rank with ties using RANKX’s DENSE option
- Explain how SKIP and DENSE number the rank after a tie
- Hide a rank on the total row with ISINSCOPE
How it works
Sales amounts are rarely tied, but counts often are: four customers have exactly 30 order lines. RANKX gives tied customers the same rank, and its last argument decides what comes next:
- **SKIP** (the default): after four customers tie for 3rd, the next one is 7th, as in a sports table. - **DENSE**: the next one is 4th, so the ranks are a gapless list of “levels”.
The full form is `RANKX(table, expression, value, order, ties)`. You can leave the value empty and still pass the later arguments: `RANKX(ALL(Product[Product]), [Total Quantity], , DESC, DENSE)` ranks every product by units sold, densely.
A rank means nothing on the total row (RANKX would show 1 there). Wrap it in `IF(ISINSCOPE(Customer[Customer]), …)` so it only appears on customer rows. The newer `RANK(DENSE, ALL(Product[Product]), ORDERBY([Total Quantity], DESC))` does the same job and returns blank on the total by itself.
Practice it hands-on with a real data model and a live report that updates as you type.
Price Level = IF(ISINSCOPE(Product[Product]), RANKX(ALL(Product[Product]), CALCULATE(MAX(Product[Price])), , DESC, DENSE))