1

I have a column:

Column
1.1
1.2
1.3
1.4
...

I want it to be transformed into:

Column1    Column2
1.1        1.2
1.3        1.4
...

The only way I can think of is: Add index column-> Extract even rows-> Extract odd rows-> Filter rows-> Merge them But is there any faster and simpler way to do it?

1
  • sebastian! has the problem been solved? Commented Jun 29, 2021 at 16:14

2 Answers 2

2

Do these steps in power query

  • Insert index from 0
  • calculate modulo by 2
  • calculate integer division by 2 (on index again)
  • remove index
  • pivot (don't aggregate)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

I provide this answer as an alternative slightly different of what you're mentionning as the steps to the solution (couldn't replicate yours though).

Steps are renamed so you may follow what's being done.

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    RemoveAlternateUneven = Table.AlternateRows(Source,0,1,1),
    AddIndexUneven = Table.AddIndexColumn(RemoveAlternateUneven, "Índice", 0, 1, Int64.Type),
    RemoveAlternateEven = Table.AlternateRows(Source,1,1,1),
    AddIndexEven = Table.AddIndexColumn(RemoveAlternateEven, "Índice", 0, 1, Int64.Type),
    MergeQueries = Table.NestedJoin(AddIndexEven, {"Índice"}, AddIndexUneven, {"Índice"}, "Índice agregado1", JoinKind.LeftOuter),
    ExpandQuery = Table.ExpandTableColumn(MergeQueries, "Índice agregado1", {"Column"}, {"Column.1"}),
    RemoveIndex = Table.RemoveColumns(ExpandQuery,{"Índice"})
in
    RemoveIndex

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.