How to unpivot your data

One of the first steps you have to take when making a visualization is getting your data in the correct format for the type of chart you want to make. 

In the past, any data restructuring would have had to happen outside of Flourish, using spreadsheet formulae, coding, or manual reshaping. Our unpivoting feature lets you transform your data by combining data columns within templates themselves with just a few simple steps.

This can be particularly useful when you have wide data but the visualization you are looking to make requires long data. 

It works in the opposite way to a pivot table: unpivoting takes multiple columns and “melts” them together into just two – one which contains the original column header and one which contains the value.

In the example below, we've used the unpivot feature with a dataset on student-teacher ratios in Europe. We wanted to create a connected dot plot, so we used unpivot to combine our category columns into a category and a value column.

Beforehand, our data had separate columns for Primary and Upper Secondary education. 

After unpivoting, we have our category and value columns, all ready to create our connected dot plot.

How to unpivot your data

    1
    Upload your data to the template you are wanting to use.

    TIP: If you are new to unpivoting, you may want to duplicate your visualization before trying it out. Combining your columns is an irreversible action, so if you want to go back to your original data structure afterward, you'll need to upload it again.

    2
    Highlight the columns you want to combine. You can do this by simply clicking and dragging across the column headers, or by clicking the first column header, holding the Shift key, and clicking on the last column header you want to select.

    3
    Open the dropdown by clicking the small arrow when hovering over any of the selected columns' headers, and choose Combine columns ("unpivot").

    4

    Before you confirm the unpivoting, you’ll be shown a preview of your new data table. In this box, you can also choose to include/exclude empty rows and whether to sort by the order of the original headers. Once you are happy, click Confirm.

    5
    The columns you selected have now been combined and your data is now in long format. You now have a Label and a Value column you can use with column bindings to achieve your visualization.