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

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
v-rongtiep-msft
Community Support
Community Support

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)

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