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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Insert "number of row" column in matrix

Hello! I am in need of some serious help. I have a matrix that has one row, one column and 2 values. The matrix is sorted by"suma", descending order in totals. "suma" = sum(x) 

I want to add a column with the row number (column with red values): 

eugeniaCastilla_0-1647518631786.png

I have tried to use the RANK function as follows: 

Ranking sales = CALCULATE( RANKX(ALL( table[ITEMS]), calculate([suma]), ,desc), ALLSELECTED(table[GROUP]))
 
And several versions of that formula, and I get a column that does what I want when displayed in a normal table, but when I try to add it to the matrix, I can't incorporate it as a row. The only place where I can include it is as another value.
 
I have been told in another forum to "Add a disconnected table with the values of ranking 1 to 20 (or more if you need) this can be added using an what if parameter" but I dont know what this means..
Please help!!! 
3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure = RANKX(ALLSELECTED('Table'[Item]),[suma],,DESC,Dense)

vpollymsft_0-1647935875336.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

 

amitchandak
Super User
Super User

@Anonymous , try like

 

Ranking sales = RANKX(ALLselected( table[ITEMS]), calculate([suma],removefilters(table[GROUP])), ,desc)

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

hi @amitchandak , thanks for your response, unfortunately it didn't work. I still have the same problem, Power BI doesn't let me add the new measure to the matrix as a row, only as a value.

If I add the calculation you gave me as a new column, not a new measure, and incude it in the matrix, something weird happens and the whole table goups by the number 1.... very weird

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors