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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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