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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Use RANKX with column ID or column not calculated

Hello everybody, I would like to know if I can use RANKX function with column ID or column not calculated ? If not, is there a solution to display the first ten rows of this table (knowing that I tried with the TOP N filter on the ID column, but it didn't work).

 

oguedda_0-1611676477054.png

Thank you in advance for your answers,

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous you have to be very specific about what does the first ten-rows means? sorted by id? ascending or descending? If you want to keep the order the way it is then it is going to be a different solution. Always provide a context about your question.

 

Although solution @amitchandak provided should work depending on what you are looking for.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@Anonymous , The information you have provided is not making the problem clear to me. Can you please explain with an example.

 

With Column ID you can use column Rank that will not be dynamic

Rankx(all(Table), [column ID],,asc)

 

You need to have this with some measure

rankx(all(Table[column id]), calculate(countrows(Table)))

 

You can filter visual on <=10

 

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Appreciate your Kudos.


Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I would simply like to display the first 10 rows of this table

 

oguedda_0-1611677404018.png

 

@Anonymous , Top 10 based on any measure would be like this

Top 10 Rank = CALCULATE(calculate(countrows(Table)),TOPN(10,all(Table[id]),calculate(countrows(Table)),DESC),VALUES(Table[Id]))

 

Else top 10 based just ID column rank, you have a filter at the visual level

Rankx(all(Table), [ID],,asc)

 

Here we need the basis of top 10 filter

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandakI used the first formula as you indicated to me, but it still shows me all the lines

at first, I created a measure like this :

IDN3 = CALCULATE(CALCULATE(COUNTROWS(Tracking)),TOPN(10,FILTER( Tracking, Tracking[IsInPeriode] = 1 &&Tracking[glpi_dropdown_tracking_category.name] = "Incidents" && Tracking[priority] = 4) ,calculate(countrows(Tracking)),DESC),VALUES(Tracking[Id]))

 

ana i had this result : ppbi.png

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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