Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Rearrange Data table

Hi, I'm trying to rearrange my data table on Power Query, but i don't know how to do it.

My data looks like this:

 

 

And i want it to rearrange it to look like this:

 

 

So, basically, I want to make only 4 columns with the type (Trabalho), Year, Month and values.

 

Can somebody help me? Please! I'm stuck in this for a week!

  • =#table(4,List.TransformMany(Table.ToColumns(PreviousStepName),each List.Skip(_,3),(x,y)=>List.FirstN(x,3)&{y}))

4 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    =#table(4,List.TransformMany(Table.ToColumns(PreviousStepName),each List.Skip(_,3),(x,y)=>List.FirstN(x,3)&{y}))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sorry! It can be like this?

       

      Column1 Column2 Column3 Column4 Column5
      TRABALHO TRABALHO TRABALHO TRABALHO TRABALHO
      2022 2022 2022 2022 2022
      Mar Abr Mai Jun Jul
      627 618 426 594 871
      484 875 487 47 656
      392 641 428 19 724
      757 660 824 59 580
      206 468 923 369 345
      536 709 337 215 834
      643 406 924 435 332
      836 413 379 64 687
      102 249 712 599 857
      201 237 856 829 382
      617 650 594 40 571
      601 1 116 805 770
      507 143 702 799 259
      355 54 705 627 522
      204 533 120 419 861
      498 283 303 764 612
      532 889 941 546 572
      611 213 850 513 975
      792 171 38 848 530
      973 393 14 214 831