Rank(Sum(Sales))

Rank in Power BI

Qlik's Rank() ranks rows within the current column segment and has its own tie modes and a text format ("3 - 4"). In DAX, use RANKX or the newer RANK window function. Pick the ties option deliberately.

Partial / different approach DAX

Short answer: Use RANKX(ALLSELECTED(Product[Name]), [Sales], , DESC, SKIP), or RANK(SKIP, ALLSELECTED(Product[Name]), ORDERBY([Sales], DESC)). Qlik's default tie handling (mode 0, shown as text such as "3 - 4") has no DAX equivalent.

What it does in Qlik

Rank([TOTAL] expr [, mode [, fmt]]) ranks the current row against the others in the column segment, which is all rows with the same outer dimension values. The highest value gets rank 1. For ties, mode sets the number (lowest, average, highest, or sequential with mode 4) and fmt sets the text (default "low - high").

Qlik example

Qlik chart expressions
Rank(Sum(Sales))          // default mode 0, fmt 0
Rank(Sum(Sales), 1, 1)    // ties share the lowest rank, shown as one number
Rank(TOTAL Sum(Sales))    // across the whole column, ignoring the outer dimension

Power BI equivalent

RANKX (classic)

DAX
Sales rank =
IF (
    HASONEVALUE ( Product[Name] ),
    RANKX ( ALLSELECTED ( Product[Name] ), [Sales], , DESC, SKIP )
)

RANK window function

DAX
Sales rank (window) =
RANK ( DENSE, ALLSELECTED ( Product[Name] ), ORDERBY ( [Sales], DESC ) )

In a matrix by Category > Product, ALLSELECTED(Product[Name]) keeps the row's Category filter, so ranks restart per category. That is Qlik's column segment. Add ALLSELECTED(Product[Category]) to rank across all categories, like Rank(TOTAL ...).

Gotchas and behaviour differences

  • Ties: Qlik mode 1 (lowest rank on all tied rows) is SKIP. Qlik mode 4 (sequential numbering) is closer to ROWNUMBER. Mode 0 and the default "3 - 4" text have no DAX equivalent.
  • Without the HASONEVALUE guard, RANKX returns 1 on total rows.
  • Products with no sales are still in ALLSELECTED(Product[Name]) and get the last rank. Qlik does not show rows with zero values by default.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.