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
CrazyFrog
Frequent Visitor

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors