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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Cedbont
Regular Visitor

Expand a complete list of items from a summarized one

Hi there!

 

I have got a "summarized" list of items in Excel stating:

  • The type of item: A, B, C...
  • The number of categories of each item: 1 to N
  • The number of subcategories of each item (that is identical in each category of the said item): 1 to M.

 

Here is an example:

Cedbont_0-1699026667595.png

 

I would like to get the complete expanded list of items looking like the following:

Cedbont_1-1699026755940.png

 

Does anyone know how to do that?

 

Thanks in advance!

 

Cedbont

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Create 2 columns in Power Query using the column value to create a list in each:

First one  {1..[Number of Categories]}

Second one {1..[Number of Subcategories]}

--

remove the category and subcat columns.

Expand the list columns from the header (into New Rows)

View solution in original post

4 REPLIES 4
slorin
Super User
Super User

@Cedbont 

Pourquoi vouloir utiliser List.Generate alors que {1..[Column2]} fonctionne bien ?
List.Reverse au besoin pour l'ordre inverse.

Stéphane

Hi,

 

Because I struggled. Now I got it.

 

Thanks!

 

Cedbont.

HotChilli
Super User
Super User

Create 2 columns in Power Query using the column value to create a list in each:

First one  {1..[Number of Categories]}

Second one {1..[Number of Subcategories]}

--

remove the category and subcat columns.

Expand the list columns from the header (into New Rows)

Hi,

 

I partly succeeded in doing what you advised.

 

Here is my code:

= Table.AddColumn(#"Type modifié", "Personnalisé", each List.Generate( () => [Column2] , each _ >= 1 , each _ -1 ) )

= Table.ExpandListColumn(#"Personnalisée ajoutée", "Personnalisé")

 

Here is the result:

Cedbont_0-1699268444011.png

 

You notice ranks are deacreasing in the 4th column (as requested in the list.generate function).

 

I tried to have it increasing without success. Here is my code and the error message:

= Table.AddColumn(#"Type modifié", "Personnalisé", each List.Generate( () => 1 , each _ <= [Column2] , each _ +1 ))

= Table.ExpandListColumn(#"Personnalisée ajoutée", "Personnalisé")

 

Cedbont_2-1699268662041.png

 

I do not see where I have it wrong... Would someone mind to help me?

 

Thank you

 

Cedbont

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors