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

Add Number to a Column

Hi all!!

I need to create this table



Ranking.PNG

The table is ranked for the value of the right that it is calculated.

What I need is to add a simple column adding numbers per row in order, the hig value has 1 and so on.

Any idea? I think is kind of ranking (rank) but really is more simple because the rank is given for the right column

Regards

6 REPLIES 6
Anonymous
Not applicable

Dear Juampe,

 

Use the below DAX Expression in the calculated column. Table1 is the Table Name and Index is the column name where you have row number.

 

= CALCULATE ( COUNT ( Table1[Index] ), FILTER ( ALLSELECTED ( Table1 ), Table1[Index] <= MAX ( Table1[Index] ) ) )

 

Hope this information helps a lot.

 

Regards,

Pradeep 

Anonymous
Not applicable

Thanks for the response but didn´t work

Anonymous
Not applicable

Dear Juampe,

 

I will provide you the simplest way to do this.

 

1. Go to your dataset and click on the ellipses (...) and select edit query. 

2. Then, go to Add column Menu on the top and select "Custom" value from Index Column option.

Index Column.PNG

3. Enter starting Index is 1 and Increment is 1. Click on OK. 

4. Go to Home Menu and Click on Close & Apply option 

5. You are set to go. The above steps will create an index column in your Dataset and you are good to go.

 

Regards,

Pradeep

Anonymous
Not applicable

Thanks for adding more stages

Now I have the following reslut

I still havent got the numbers in order.

I want 1,2,3,4,5 dependign the total rows that I have in the table

 

RegardsRanking2.PNG

Hi @Anonymous ,

I have a still confused about your requirement.

If I understand your scenario correctly that you want to create an index column in your table?

If you just create an index column for all of the rows for your table you could create the index column in Query Editor which Pauwnrajpp has mentioned.

If you want to create the index column based on the rank of the specific column, you need create a dax formula with Rankx function.

Please have a reference of this similar thread.

If you still need help, please share your data sample which could reproduce your scenario and your desired output.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

 

 

Well its more complicated than that:
1º  I Have in the data model a huge table with lets say 10 different questions and 1000 people answering that questions  (from 1 point to 10) what means 10.000 rows for jsut only 10 questions

2º Then in the Data Viz frame where I am adding all the graphs and stuff like that I want a Table with those 10 questions and the average grade of the answers
3º I need an extra column ranking the Answers From the highest grade (number 1)  to the lowest (number 10)

The problem is that this table is not in the Data Model is like Group BY table from the Data model and I cant get the proper solution to add this column


This will be the source table or the origin of the information
Community1.PNG

 

This one is the tabel that I want to show in the Data visualziation frame in wich I want the Average os the total responses for the questions

Community2.PNG
Thanks

 

 

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.