Forum Discussion

K_MD___'s avatar
K_MD___
Frequent Visitor
2 years ago

Top 2 Categories

Hi All,

The provided measure, "Top2_orders," functions correctly when used with the Category field alone. It filters and displays the top two categories as expected. However, when the Subcategory field is added to the table, it fails to filter accordingly, displaying all data instead.Top2_orders = VAR CategoryRank = RANKX( ALL(Orders[Category]), [total sales],, DESC, Dense ) RETURN IF( CategoryRank <= 2, [total sales], BLANK() )
Expected Output:
Its used Visual level filter working fine

My Output:Using the above dax( I need only top 2 category Tech and Furniture and related subcategories)Used superstore dataset

 





1 Reply