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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
natabird3
Skilled Sharer
Skilled Sharer

Populate a number count of the rows in a table displayed

Hello,

 

Maybe a stupid question but is there a way to always have a number sort order to each table, meaning when i display some data in a table to always have 1,2,3,4,5, etc. in the beginning of the table. Ideally, not using any rankx functions as i am not ranking anything but simply would like to have the number of rows dispalyed not as a sum but by numbers. Is this possible somehow to be done in Power bi or would need to always add it manually after exporting the file? Please let me know, thanks.  

 

Example if i now have this:

TextTextTextText
ValueValueValueValue
ValueValueValueValue
ValueValueValueValue

 

What i would like ideally to have is:

NumberTextTextTextText
1ValueValueValueValue
2ValueValueValueValue
3ValueValueValueValue

 

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@natabird3 

 

Hi, try this:

 

1. Add a Index Column in Power Query

 

2. Create a measure

 

indexdinamyc =
VAR index =
    SELECTEDVALUE ( 'Table (2)'[Index] )
RETURN
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Table (2)' ); 'Table (2)'[Index] <= index )
    )

 

3. Add this measure in your visual table

 

img.png

Note: Maybe is you use aggregations this need some extra adjustments.

 

Regards

 

Victor




Lima - Peru

View solution in original post

11 REPLIES 11
Vvelarde
Community Champion
Community Champion

@natabird3 

 

Hi, try this:

 

1. Add a Index Column in Power Query

 

2. Create a measure

 

indexdinamyc =
VAR index =
    SELECTEDVALUE ( 'Table (2)'[Index] )
RETURN
    COUNTROWS (
        FILTER ( ALLSELECTED ( 'Table (2)' ); 'Table (2)'[Index] <= index )
    )

 

3. Add this measure in your visual table

 

img.png

Note: Maybe is you use aggregations this need some extra adjustments.

 

Regards

 

Victor




Lima - Peru

That seemed to work for me thank you. 

AilleryO
Memorable Member
Memorable Member

Hi,

 

You can easily add an index column to your model.

In Power Query, use on the tab Add Column, the Button Index Column.

 

It should do the trick,

Thank you for the quick reply @AilleryO , sorry, maybe one point that i forgot to mention is, i will filter the values, therefore it wil not be the order of how they are in the data. So unfortuantely, index will not do the trick as it will display the number as the way the data was loaded. It will need to be dynamic, but the only way i know is using a rankx measure, but i was wondering if there was some dynamic indexing in the tables.

Hi,

 

You're welcome.

And the COUNTROWS function is not of any help in your case ?

 

Have a nice day

No unfortuntely, it doesnt seem to be working for me.

And :

 

SUBSITUTEWITHINDEX so you can already select your data, and then INDEX them ?

With this solution i think i will need to define the index 1 by 1 in my undertanding of how it works.

Capture3.JPG

Capture1.JPG

Hi,

 

Isn't it possible for you to create a calculated column ?

before using SUBSTITUTEWITHINDEX, to lessen the possibilities...

No, i dont think so. I think since there doesnt seem to be a function or feature that supports this at the moment in Power Bi, for my case the easiest way would be then to use a rankx function and rank a single value column.

Hi,

 

As far as i have known, i think there is no such function expect using ranking measure to show dynamical index.

And i think what you said is a cool idea, you can create an idea here:

https://ideas.powerbi.com/forums/265200-power-bi-ideas 

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.