0

I have a list in my Excel file as folowing :

enter image description here

As you can see i only have the values in one column the others are blanks, i want the folowing result as a table :

enter image description here

i have more than 99 row, can someone help with dax or M code Thank you !

2
  • Is the data format is always consistent as you showed? like consecutive 3-row belong to 3 columns? Always a blank after 3 rows?
    – mkRabbani
    Commented May 24, 2023 at 12:43
  • Yes ! Always 3 rows then blank
    – Miraiinik
    Commented May 24, 2023 at 12:57

1 Answer 1

5

If it is always three rows, blank, three rows, you can do this in powerquery, pasted into home...advanced editor...

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
row_groupings = 3,
#"Filtered Rows" = Table.SelectRows(Source, each ([Name] <> null and [Name] <> "")), 
#"Added Index" = Table.AddIndexColumn(#"Filtered Rows", "Index", 0, 1, Int64.Type),
#"Added Index1" = Table.AddIndexColumn(#"Added Index", "Index.1", 0, 1, Int64.Type),
Column = Table.TransformColumns(#"Added Index1",{{"Index", each Number.Mod(_, row_groupings), Int64.Type}}),
Row = Table.TransformColumns(Column,{{"Index.1",each Number.IntegerDivide(_, row_groupings), Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(Row, {{"Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(Row, {{"Index", type text}}, "en-US")[Index]), "Index", "Name"),
#"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Index.1"})
in  #"Removed Columns"

enter image description here

1
  • Thank you for your answer but something is off , it's giving me a , b , c, blank ,a ,b c,blak , a etc like there is a blank after the "c"
    – Miraiinik
    Commented May 24, 2023 at 13:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.