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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
natabird3
Continued Contributor
Continued Contributor

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
natabird3
Continued Contributor
Continued Contributor

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,

natabird3
Continued Contributor
Continued Contributor

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

natabird3
Continued Contributor
Continued Contributor

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

And :

 

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

natabird3
Continued Contributor
Continued Contributor

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

natabird3
Continued Contributor
Continued Contributor

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors