Bird
Raised Fist0
Power BIbi_tool~20 mins

RANKX for ranking in Power BI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
RANKX Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ dax_lod_result
intermediate
2:00remaining
Calculate rank of sales by product
Given a Sales table with columns Product and SalesAmount, what is the rank of Product 'B' using this measure?

Rank Sales = RANKX(ALL(Sales[Product]), SUM(Sales[SalesAmount]), , DESC, Dense)

Sales data:
Product A: 100
Product B: 200
Product C: 150
Power BI
Rank Sales = RANKX(ALL(Sales[Product]), SUM(Sales[SalesAmount]), , DESC, DENSE)
A3
B2
C1
DError
Attempts:
2 left
💡 Hint
Remember that DESC means highest value gets rank 1.
❓ visualization
intermediate
1:30remaining
Best visualization for showing product ranks
You want to show product sales ranks on a dashboard. Which visualization best shows the rank order clearly?
ABar chart sorted by rank ascending
BPie chart showing sales amounts
CScatter plot with sales on X and product name on Y
DTable with product names only
Attempts:
2 left
💡 Hint
Think about which chart shows order clearly.
❓ data_modeling
advanced
2:30remaining
Ranking with filters and context
You have a Sales table with Product, Region, and SalesAmount. You want to rank products by sales within each Region. Which DAX measure correctly calculates this?
ARank by Region = RANKX(ALL(Sales[Product]), CALCULATE(SUM(Sales[SalesAmount]), ALLEXCEPT(Sales, Sales[Region])), , DESC, DENSE)
BRank by Region = RANKX(ALL(Sales[Product], Sales[Region]), SUM(Sales[SalesAmount]), , DESC, DENSE)
CRank by Region = RANKX(ALLSELECTED(Sales[Product]), CALCULATE(SUM(Sales[SalesAmount])), , DESC, DENSE)
DRank by Region = RANKX(ALL(Sales[Product]), SUM(Sales[SalesAmount]), , DESC, DENSE)
Attempts:
2 left
💡 Hint
You want to keep Region filter but remove Product filter inside RANKX.
🔧 Formula Fix
advanced
2:00remaining
Identify error in RANKX measure
This DAX measure is intended to rank products by sales but returns an error:

Rank Sales = RANKX(Sales[Product], SUM(Sales[SalesAmount]))

What is the cause of the error?
Power BI
Rank Sales = RANKX(Sales[Product], SUM(Sales[SalesAmount]))
AMissing order argument DESC or ASC
BSUM cannot be used inside RANKX
CRANKX requires a filter argument
DRANKX expects a table as first argument, but Sales[Product] is a column, not a table
Attempts:
2 left
💡 Hint
Check the first argument type for RANKX.
🧠 Conceptual
expert
2:30remaining
Effect of ranking method on ties
You use RANKX with the Dense ranking method on sales data with ties. How does Dense ranking handle ties compared to Skip ranking?
ADense ranking skips ranks after ties, next rank increments by number of tied items
BDense ranking assigns the same rank to ties and next rank increments by 1
CDense ranking assigns unique ranks ignoring ties
DDense ranking always assigns rank 1 to all tied items
Attempts:
2 left
💡 Hint
Think about how ranks progress after ties in Dense vs Skip.

Practice

(1/5)
1.

What does the RANKX function do in Power BI?

easy
A. It filters data based on a condition.
B. It calculates the sum of a column.
C. It assigns a rank number to each item based on a value.
D. It creates a new table from existing data.

Solution

  1. Step 1: Understand the purpose of RANKX

    RANKX is used to order items by a value and assign a rank number.
  2. Step 2: Compare with other functions

    Unlike filtering or summing, RANKX specifically ranks items.
  3. Final Answer:

    It assigns a rank number to each item based on a value. -> Option C
  4. Quick Check:

    RANKX = Assign rank [OK]
Hint: RANKX orders and numbers items by value quickly [OK]
Common Mistakes:
  • Confusing RANKX with SUM or FILTER functions
  • Thinking RANKX creates new tables
  • Assuming RANKX filters data
2.

Which of the following is the correct syntax to rank sales by product using RANKX?

RANKX(____, [Sales])
easy
A. VALUES(Products[ProductName])
B. FILTER(Products, [Sales] > 0)
C. ALL(Products)
D. SUMMARIZE(Products, Products[ProductName])

Solution

  1. Step 1: Identify the table argument for RANKX

    RANKX requires a table of items to rank, typically a list of unique products.
  2. Step 2: Choose the correct function returning unique product names

    VALUES(Products[ProductName]) returns unique product names, suitable for ranking.
  3. Final Answer:

    VALUES(Products[ProductName]) -> Option A
  4. Quick Check:

    Use VALUES for unique items in RANKX [OK]
Hint: Use VALUES() to get unique items for RANKX table argument [OK]
Common Mistakes:
  • Using ALL without specifying column
  • Using FILTER which returns a table but may exclude items
  • Using SUMMARIZE without proper columns
3.

Given the following measure:

Rank Sales = RANKX(ALL(Products), [Total Sales], , DESC, Dense)

What rank will the product with the highest sales receive?

medium
A. It depends on the number of products
B. 1
C. The highest sales product will have the lowest rank number
D. 0

Solution

  1. Step 1: Understand RANKX parameters

    ALL(Products) removes filters, ranking all products by [Total Sales] descending.
  2. Step 2: Determine rank for highest sales

    DESC order means highest value gets rank 1, Dense ranking handles ties without gaps.
  3. Final Answer:

    1 -> Option B
  4. Quick Check:

    Highest value rank = 1 [OK]
Hint: DESC order means highest value ranks 1 [OK]
Common Mistakes:
  • Thinking rank starts at 0
  • Confusing ascending and descending order
  • Ignoring Dense ranking behavior
4.

Identify the error in this RANKX formula:

Rank = RANKX(Products, [Sales], , ASC)

medium
A. The third argument (value) is missing and required
B. The order ASC is invalid, must be DESC
C. RANKX cannot rank by [Sales]
D. Missing table argument should be ALL(Products)

Solution

  1. Step 1: Check the table argument

    Using Products directly may apply current filters; ALL(Products) removes filters for full ranking.
  2. Step 2: Confirm order and arguments

    ASC is valid; third argument is optional; ranking by [Sales] is allowed.
  3. Final Answer:

    Missing table argument should be ALL(Products) -> Option D
  4. Quick Check:

    Use ALL() to rank all items ignoring filters [OK]
Hint: Use ALL() to rank all items ignoring filters [OK]
Common Mistakes:
  • Assuming ASC is invalid
  • Thinking third argument is mandatory
  • Not using ALL() to remove filters
5.

You want to rank products by sales but treat ties by assigning the same rank and skipping ranks after ties (standard competition ranking). Which RANKX parameter should you use?

hard
A. "Standard" to assign same rank and skip ranks after ties
B. "Dense" to assign same rank and no gaps after ties
C. "Skip" for ties to skip ranks after ties
D. "Unique" to assign unique ranks even if values tie

Solution

  1. Step 1: Understand tie handling options in RANKX

    RANKX supports "Skip" (standard competition), "Dense" ranking methods.
  2. Step 2: Identify standard competition ranking

    Standard competition ranking assigns same rank to ties and skips ranks after ties.
  3. Final Answer:

    "Standard" to assign same rank and skip ranks after ties -> Option A
  4. Quick Check:

    Standard = skip ranks after ties [OK]
Hint: Use "Standard" to skip ranks after ties in RANKX [OK]
Common Mistakes:
  • Confusing Dense with Skip ranking
  • Using non-existent "Unique" option
  • Assuming ties always get unique ranks
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard