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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Certain number of index values for dynamic number of rows

Hello,

I am currently trying to implement the following: I have given the following table with a dynamic number of scenarios and their corresponding AddValue values. 

Annotation 2024-01-25 120547.png

Now I am trying to insert indices from 0 to 15 for each scenario (see screenshots from excel example):

Annotation 2024-01-25 120731.png

I am grateful for any help. Thanks in advance!

 

 

1 ACCEPTED SOLUTION
collinsg
Super User
Super User

Hi CrazyFrog,

An approach is to,

  1. Add a column "Index" containing a list 0-15 for each row.
  2. Expand the list to rows.

Here is example code,

let
Source = Excel.CurrentWorkbook(){[Name="tbl"]}[Content],
#"Added Index List" = Table.AddColumn(Source, "Index", each List.Numbers(0,16,1)),
#"Expanded Index List" = Table.ExpandListColumn(#"Added Index List", "Index"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Index List",{{"Index", Int64.Type}, {"Add Value", Int64.Type}, {"Scenario", Int64.Type}})
in
#"Changed Type"

yielding,

 

collinsg_0-1706181753697.png

 

View solution in original post

1 REPLY 1
collinsg
Super User
Super User

Hi CrazyFrog,

An approach is to,

  1. Add a column "Index" containing a list 0-15 for each row.
  2. Expand the list to rows.

Here is example code,

let
Source = Excel.CurrentWorkbook(){[Name="tbl"]}[Content],
#"Added Index List" = Table.AddColumn(Source, "Index", each List.Numbers(0,16,1)),
#"Expanded Index List" = Table.ExpandListColumn(#"Added Index List", "Index"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Index List",{{"Index", Int64.Type}, {"Add Value", Int64.Type}, {"Scenario", Int64.Type}})
in
#"Changed Type"

yielding,

 

collinsg_0-1706181753697.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.