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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
JacoMathew
Frequent Visitor

Create Index on a table in Data pane and not in Power Query

Hi,

I have created a simple list of String using the Create Table in Data pane. I wanted to create a column that shows the row number. I came accros RankX but that sorts using the string and assign a Rank. What I want is the row number should be assigned irrespective of the order of string, similar to the index function in Power Query. I tried to use the Generateseries() function but it shows error that GenerateSeries returns a table. Here is what I have tried :

Created a table that has 30 items. The order of the list has to be based on the given list and not alphabetical.

TopN =
{
"Indian Bank",
"Canara Bank",
"UCO Bank",
"Indian Overseas Bank",
....
}

 

I tried to add a column using GenerateSeries function

Order = GENERATESERIES(1,COUNTROWS(TopN),1)
 

But this gives me an error as GenerateSeries returns a table.

 

Is it possible to add generateseries value when I create the table in the below method ?

TopN =

VAR _List =
{
"Canara Bank",
"Indian Bank",
"Indian Overseas Bank",
"UCO Bank",
....
}


Var _Order =
GENERATESERIES(1, COUNTROWS(_List), 1)
 
RETURN

( A table should be returned with Column Name "List" = _List and "Order"= _Order)

I thought a running total might work but was unsuccessful. I created a column with just a value 1 after creating the list and thought I could do sum of all the 1 values upto current row. Couldn't get that to work as Running total uses a Rank which is created by sorting the List string. 

 

Any suggestion on how I could create a table with a list and an order column based on the number of rows in the list ?

Thanks,

 

Jaco

 
4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

You could create it using a veeeery long SWITCH expression...

However, if the list is static, I would probably create it in Excel including the index column and copy/paste it into a table using "Enter Data" in the ribbon.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Fowmy
Super User
Super User

@JacoMathew 

I doubt you can have a number sequence without associating it to an existing column or columns. What stops you from creating a table in Power Query and adding an Index Column.?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

I know it can be done with Power Query. I wanted to know if it can be done from the Data pane. Thought I was missing something simple. Has happened to me in the past. I guess for now, I will move the table creation to Power Query.

 

I used switch expression for another table but that had only 5 items.

 

 

@JacoMathew 

Yes, that's the right approach 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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