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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jo_Chrq
Helper I
Helper I

Column with line number in PBI table

Hello,

I did a report with a table that ranks several brands my company sells, based on each brand income.

I would like to add a first column with the line numbers (ranking).

Is there a way to do so?

 

Thanks in advance

Jo

1 ACCEPTED SOLUTION

Hi @Jo_Chrq ,

 

You can also try

RANK = RANKX(ALL('Table'[Regions   ],'Table'[Stores     ]),CALCULATE(SUM('Table'[Revenue  ])))

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

Hi @amitchandak 

Yes  believe that's it.

If you consider the following table, I have the columns "Stores" and "Revenue" and basically I need to add the Rank column :

Rank (column needed)StoresRevenue
1Store B100€
2Store C95€
3Store A75€

Hi @Jo_Chrq ,

 

Create these 2 measures

 

Total Sales = SUM('Table'[Revenue])

 

RANK = RANKX(ALL('Table'[Stores]), [Total Sales],,DESC)

 

1.jpg

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

Hi @harshnathani 

Thank you, I'm now getting really close but still have an issue.

The table actually has an extra column and the ranking I get is within these categories (btw I apologize for my poor English level ...)

Here's the result I get :

Rank  Regions   Stores     Revenue  

1

NorthStore B100€

2

NorthStore C95€
1SouthStore A75€
3NorthStore F60€
2SouthStore D55€

 

I would like to have the overall ranking, regardless the regions ...

 

Many thanks again

Hi @Jo_Chrq ,

 

RANK = RANKX(ALL('Table'),CALCULATE(SUM('Table'[Revenue  ])))

 

1.jpg

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @Jo_Chrq ,

 

You can also try

RANK = RANKX(ALL('Table'[Regions   ],'Table'[Stores     ]),CALCULATE(SUM('Table'[Revenue  ])))

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @harshnathani 

Yes it works perfectly! thanks

Jonathan

Pragati11
Super User
Super User

Hi @Jo_Chrq ,

 

Please share additonal details on your query. This is not helping at all.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

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!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.