Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Rankx

   
   
sales groupyearvolume
abc202256
abc202365
abc2024112
xyz202243
xyz202334
xyz202455
mno202276

 

I have a data which looks like this.
I want to use sales group as legend in one of the visual.
the data has more than 30 sales group. Hence i want to make a measure which will give me top 12 sales group to be used as legend depending upon there volume of next three years.

Example:
from above dataset
abc = 56+65+112 = 233
xyz = 132

hence abc should be ranked as 1 and xyz to be second dynamically and the measure can be used as Legend in bar chart.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I create a new table with DAX as below to help calculate the ranking of groups. Then use the "Is Top 5" column as a filter on the column chart. 

vjingzhang_0-1653361842689.png

 

Table 2 = SUMMARIZE('Table','Table'[Sales Group],"Sum of Volume",SUM('Table'[Volume]))

 

Rank = RANKX('Table 2','Table 2'[Sum of Volume],,DESC,Dense)
Is Top 5 = IF('Table 2'[Rank] <= 5, 1)

vjingzhang_1-1653362025493.png

 

The sample file has been attached at bottom. Hope it helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I create a new table with DAX as below to help calculate the ranking of groups. Then use the "Is Top 5" column as a filter on the column chart. 

vjingzhang_0-1653361842689.png

 

Table 2 = SUMMARIZE('Table','Table'[Sales Group],"Sum of Volume",SUM('Table'[Volume]))

 

Rank = RANKX('Table 2','Table 2'[Sum of Volume],,DESC,Dense)
Is Top 5 = IF('Table 2'[Rank] <= 5, 1)

vjingzhang_1-1653362025493.png

 

The sample file has been attached at bottom. Hope it helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.