Forum Discussion

JohnJairoV's avatar
JohnJairoV
Helper I
9 years ago
Solved

Reorder data with Power Query repeating words

Hi to all!

 

I have this data:

 

PaisAireAguaTierraFuego
Colombia1 32
Argentina221 
México 112
Perú13 1

 

And I like to transform with Power Query, like this:

 

PaisObjeto
ColombiaAire
ColombiaTierra
ColombiaTierra
ColombiaTierra
ColombiaFuego
ColombiaFuego
ArgentinaAire
ArgentinaAire
ArgentinaAgua
ArgentinaAgua
ArgentinaTierra
MéxicoAgua
MéxicoTierra
MéxicoFuego
MéxicoFuego
PerúAire
PerúAgua
PerúAgua
PerúAgua
PerúFuego

 

Thx in advance for your answers.

  • Unpivot all but the first columns,

    add a column with nested lists with the numbers {1 thru Value},

    expand this column,

    remove this column and the Value column,

    adjust the header Attribute to Objeto as illustrated in this video.

2 Replies

  • MarcelBeug's avatar
    MarcelBeug
    Community Champion

    Unpivot all but the first columns,

    add a column with nested lists with the numbers {1 thru Value},

    expand this column,

    remove this column and the Value column,

    adjust the header Attribute to Objeto as illustrated in this video.

    • JohnJairoV's avatar
      JohnJairoV
      Helper I

      Great MarcelBeug!  Works like a charm.  Blessings to you!