Dynamic ranking measures

The ranking measures in the previous section are specific to individual products. These measures cannot be used, for example, to rank product subcategories or product categories. Rather than develop many separate measures targeted at one specific column, logic can be embedded in DAX measures to dynamically adjust to the columns in the filter context.

In the following measure, a ranking is applied based on the filter context from three levels of a product hierarchy:

Internet Net Sales Product Rank (Conditional) = VAR ProductFilter = ISFILTERED('Product'[Product Name])VAR SubCatFilter = ISFILTERED('Product'[Product Subcategory])VAR CatFilter = ISFILTERED('Product'[Product Category])RETURNSwitch(TRUE(), ProductFilter ...

Get Mastering Microsoft Power BI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.