Unpivot

Say my raw dataset looks like this:

And I would like to unpivot any column that has a month name is it, so in this example, it's 'Jan 2024 Total Pts Earned' and 'Jan 2024 Pts Redeemed', and the dataset would look like this (add a date column, total pts earned and total pts redeemed column):


How can I do this with Magic ETL? I've tried the 'Unpivot' Tile but you cannot add both 'Total pts earned' and 'total pts redeemed' along with the date column.

Tagged:

Answers

  • Manasi_Panov
    Manasi_Panov Contributor

    Hello @verytiredgirl,

    You can do it in several steps. Here is the example data:

    First, make Dynamic unpivot:

    Split the unpivoted column into two columns: one for dates and one for types:

    Change the format of the 'Date' column into Date with the Alter Columns tile:

    And finally, pivot the 'Type' column:

    Here is the result:

    I hope this answers your question ;)

    If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.

  • Thank you, it worked!