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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to top 10 rows when there are duplicate values for Columns in Table Visual?

Hi All,
Please find below Sales table which should show top 10 rows based on Deal names for Clients
Client Column in original table are around 50 and Deal Name column has around 1200 Distinct Values
I want to show Top 10 rows based on Deal Name for the below table. Kindly suggest !

ClientDeal NameRevenue

ABC

Deal Number 1500M
XYZDeal Number 2490M
MNODeal Number 1490M
ABCDeal Number 3400M
XYZDeal Number 2380M
PQRDeal Number 1300M
1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Create 2 columns as below:

_count = 
var _rank1=RANKX(ALL('Table'),'Table'[Client],,ASC,Dense)
var _rank2=RANKX(ALL('Table'),'Table'[Deal Name],,ASC,Dense)
var _rank3=RANKX(ALL('Table'),'Table'[Revenue],,ASC,Dense)
var _count=CALCULATE(COUNTROWS('Table'),ALL('Table'))
Return
_rank1+DIVIDE(_rank2,_count)+DIVIDE(_rank3,_count*10)
rank = RANKX('Table','Table'[_count],,ASC,Dense)

And you will see:

v-kelly-msft_0-1623138266198.png

Finally filter out the lines which rank value is larger than 10.

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

5 REPLIES 5
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you share some sample output that you are expecting?

You can try adding an index column in your data and see if that works.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi Pragati,
It should look like this
Client name Deal Name Revenue
A                  ABC              500m
B                  ABC              500m
C                  pqr                500m
E                  MNO             300M
F                  MNO             300M

Hi @Anonymous ,

 

Create 2 columns as below:

_count = 
var _rank1=RANKX(ALL('Table'),'Table'[Client],,ASC,Dense)
var _rank2=RANKX(ALL('Table'),'Table'[Deal Name],,ASC,Dense)
var _rank3=RANKX(ALL('Table'),'Table'[Revenue],,ASC,Dense)
var _count=CALCULATE(COUNTROWS('Table'),ALL('Table'))
Return
_rank1+DIVIDE(_rank2,_count)+DIVIDE(_rank3,_count*10)
rank = RANKX('Table','Table'[_count],,ASC,Dense)

And you will see:

v-kelly-msft_0-1623138266198.png

Finally filter out the lines which rank value is larger than 10.

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Anonymous , based on need on of the two rank should help, use a visual level filter <=10

 

rankx(allselected(Table[client], Table[Deal name]), [revenue],,desc,dense)

 

or

 

rankx(filter(allselected(Table[client], Table[Deal name]),Table[client] =max(Table[client])), [revenue],,desc,dense)

 

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

Anonymous
Not applicable

Hi Amit,
Rankx is giving same rank to all clients and dealname when revenue value is same for 4 or 5 rows, how to handle that?
I want to show top 10, it is okay if the revenue value is same for them.
Kindly suggest

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.