How to expand table data in elaborated table (as shown in the attachment)

Brass Contributor

Hi Every one

 

Happy Chrismas and New Year in Advance

 

How to expand the table (Table A) based on no of sold and item. It should be shown in the same sequence in one column (Table B) itself?

6 Replies

Hi, 

Actually I want to list out unit price in the number mentioned in the no of sold. 

For Eg: 

 

Glassi Sold 8 Times. So i want to list out glassi price 8 times in the same column. 

 

@Detlef Lewin 

@Sameer_Kuppanath_Sultan 

Just to be clear: List.Numbers is a function within Power Query.

So you have to load the table into Power Query and add a custom column with containing this function.

See attached file.

 

 

Hi

 

this is a new function for me, could you please help me with step by step? @Detlef Lewin 

Does any one have any solution for this?

@Sameer_Kuppanath_Sultan 

What @Detlef Lewin suggested is to query source table by Power Query and made small transformation, generated script is looks like

let
    Source = Excel.CurrentWorkbook(){[Name="TableA"]}[Content],
    AddNo = Table.AddColumn(
        Source,
        "No",
        each List.Numbers(1,[NoOfTimes Sold])
    ),
    ExpandNo = Table.ExpandListColumn(
        AddNo, "No"
    ),
    RemoveUnused = Table.SelectColumns(
        ExpandNo,
        {"Item", "No", "Unit price"}
    )
in
    RemoveUnused

and load result back into Excel sheet. It is in attached file.