cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohnJairoV Regular Visitor
Regular Visitor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Reorder data with Power Query repeating words

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.

Specializing in Power Query Formula Language (M)
2 REPLIES 2
Highlighted
Super User
Super User

Re: Reorder data with Power Query repeating words

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.

Specializing in Power Query Formula Language (M)
JohnJairoV Regular Visitor
Regular Visitor

Re: Reorder data with Power Query repeating words

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