Forum Discussion
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
- lbendlin
Super User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523