Help please Chapter 05-05

Book Q&ACategory: Chapter 5Help please Chapter 05-05
Juan asked 8 months ago

let

Origen = Excel.Workbook(File.Contents("C:DataC05C05E05 – Products.xlsx"), null, true),

"Otras columnas quitadas" = Table.SelectColumns(Origen,{"Data"}),

#"Personalizada agregada" = Table.AddColumn(#"Otras columnas quitadas", "Parent Category", each [Data][Column1]{1}),

#"Personalizada agregada1" = Table.AddColumn(#"Personalizada agregada", "Personalizado", each Table.AddColumn([Data], "Column7", each [Data][Column1]{1})),

#"Otras columnas quitadas1" = Table.SelectColumns(#"Personalizada agregada1",{"Parent Category", "Personalizado"}),

#"Se expandió Personalizado" = Table.ExpandTableColumn(#"Otras columnas quitadas1", "Personalizado", {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7"}, {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7"})

in

"Se expandió Personalizado"

Attachments

1 Answers
Gil Raviv Staff answered 8 months ago

Hi Juan,

Sorry for the late response. I was able to run your code that was attached. The Q&A plug0in may manipulate the M code. You are welcome to contact me by email at [email protected].

Here is the code that worked on my computer (You may see it with modifications here):

let

Origen = Excel.Workbook(File.Contents("C:DataC05C05E05 – Products.xlsx"), null, true),

"Otras columnas quitadas" = Table.SelectColumns(Origen,{"Data"}),

#"Personalizada agregada" = Table.AddColumn(#"Otras columnas quitadas", "Parent Category", each [Data][Column1]{1}),

#"Personalizada agregada1" = Table.AddColumn(#"Personalizada agregada", "Personalizado", each Table.PromoteHeaders(Table.RemoveFirstN([Data], List.PositionOf([Data][Column1],"Name")))),

#"Otras columnas quitadas1" = Table.SelectColumns(#"Personalizada agregada1",{"Parent Category", "Personalizado"}),

#"Res" = Table.ExpandTableColumn(#"Otras columnas quitadas1", "Personalizado", {"Name", "ProductNumber", "Color", "StandardCost", "ListPrice", "Size"}, {"Name", "ProductNumber", "Color", "StandardCost", "ListPrice", "Size"})

in

"Res"