Analyzing and Visualizing Data with Microsoft Power BI — Question 10
You have a Power BI model that contains the following two tables:
✑ Sales(Sales_ID, sales_date, sales_amount, CustomerID)
✑ Customer(CustomerID, First_name, Last_name)
There is a relationship between Sales and Customer.
You need to create a measure to rank the customers based on their total sales amount.
Which DAX formula should you use?
Answer options
- A. RANKX(ALL(Sales), SUMX(RELATEDTABLE(Customer), [Sales_amount]))
- B. TOPN(ALL(customer), SUMX(RELATEDTABLE(Sales), [Sales_amount]))
- C. RANKX(ALL(customer), SUMX(RELATEDTABLE(Sales), [Sales_amount]))
- D. RANK.EQ(Sales[sales_amount], Customer[CustomerID])
Correct answer: A
Explanation
The correct option, A, uses RANKX with ALL(Sales) to rank customers based on their total sales amounts correctly. Option B uses TOPN, which does not provide a ranking measure, while option C incorrectly uses ALL(customer) instead of ALL(Sales). Option D misapplies RANK.EQ, which does not rank customers based on their total sales amounts.