A senior developer needs to implement a DAX measure that calculates the ratio of a product's monthly sales to the maximum monthly sales achieved by any product in the same category, for the current filter context. Which DAX approach is most appropriate?
- A. Use RANKX over the category to find the max, then divide
- B. Use TOPN(1, VALUES(DimProduct[ProductKey]), [Monthly Sales]) to find the top product's sales, then divide the current product's sales by that value
- C. Use MAXX with an iterator over the set of products in the current category filtered by ALLEXCEPT, divided by the current product's sales✓ Correct
- D. Use MAX(FactSales[SalesAmount]) divided by [Total Sales] within a CALCULATE with ALLEXCEPT(DimProduct, DimProduct[Category])
Explanation
MAXX iterates over all products in the current category (using ALLEXCEPT to remove the product filter while keeping the category filter) and returns the maximum monthly sales, which is then used as the denominator. This correctly computes the max within the category in the current filter context. RANKX finds rank positions, not the maximum value itself. Using MAX(FactSales[SalesAmount]) would return the max value in a column, not the maximum of a measure across products — it ignores the category boundary correctly. TOPN(1,...) can retrieve the top product but requires additional unpacking to get its measure value and is less efficient than MAXX for this pattern.