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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
hassanh2
Helper I
Helper I

Ranking

Hello,
I have a sales tables with the following 5 columns, I want to create a measure to Rank Sales by Activity Code. as I need to show Top 15 Activities by Sales Amount as a Tooltip in other visuals. Ranking should be based on selected filters, so if no filters applied then the tooltip should show Top 15 activities accross all countries.


Activity Code

Activity Description
City

Country

Sales Amount

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @hassanh2 

According to your description, you want to rank group by the Activity Code and you want to use the slicer to filter the Country or City.

Here are the steps you can refer to :

(1)This is my test data :

vyueyunzhmsft_0-1693188706647.png

(2)We can create a measure like this:

Measure = rankx( SELECTCOLUMNS(ALLSELECTED('Table'),"Activity Code" , [Activity Code]) , CALCULATE(SUM('Table'[Sales Amount]),ALLEXCEPT('Table','Table'[Activity Code])) ,,DESC ,Dense   )

 

Then we can get the result as follows:

vyueyunzhmsft_1-1693188740518.png

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.