- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Top N with multiple variables
I am trying to make a 100% stacked bar chart that gives me the percentage of revenue shared by the top 2 industries in a state. I don't want the overall top 2 by all states. For example, Georgia could have industry x and y as there top 2 while Florida could have industry x and z. I saw that you could make a RANKX off of another post, but PowerBi kept giving me errors. The code is as follows: RANKX(ALL(Sheet1[Industry]),CALCULATE(SUM(Sheet1[Revenue]),ALLEXCEPT(Sheet1,Sheet1[Industry],Sheet1[State])),DESC,Dense). Does anyone know if there is a more efficient way or if my code is just wrong? Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sample data and sample DAX expression for you reference.
Column = RANKX(FILTER(Table2,Table2[Country]=EARLIER(Table2[Country])),Table2[Amount],,DESC)
If this is not what you want, please provide us some sample data and your expected result, so that we can make further analysis.
Regards,
Charlie Liao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sample data and sample DAX expression for you reference.
Column = RANKX(FILTER(Table2,Table2[Country]=EARLIER(Table2[Country])),Table2[Amount],,DESC)
If this is not what you want, please provide us some sample data and your expected result, so that we can make further analysis.
Regards,
Charlie Liao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
02-18-2025 01:54 PM | |||
08-27-2024 09:18 AM | |||
03-07-2025 01:13 AM | |||
01-29-2025 11:42 AM | |||
11-05-2024 11:57 AM |
User | Count |
---|---|
141 | |
110 | |
81 | |
61 | |
46 |