Prepare · About 5 min

Reshape monthly sales columns into long format

Turn January, February, and other monthly sales columns into a month column and a sales column with DataCello's Pivot Longer operation.

Outcome
Create product, month, and sales columns that are easier to aggregate
Verified against
DataCello 4f9fe8d
Data preparation operations in DataCello
Data preparation operations in DataCello

Why long format helps

A table shaped like Product, January, February, March is easy to read but stores the month inside column names. DataCello's Pivot Longer operation stacks those monthly columns into a month field and a sales field.

Product,January,February,March
A,120,150,180

Product,Month,Sales
A,January,120
A,February,150
A,March,180

Stack the monthly columns

  1. Select the sales dataset in the sidebar, click Table, then open the Wrangle tab.
  2. Turn on Pivot Longer in the wrangling panel.
  3. Check the monthly value columns. Leave identifiers such as product or store unchecked.
  4. Enter Month in Names Column and Sales in Values Column.
  5. Confirm that each product now has one row per month in the preview.
  6. Enter a derived dataset name and click Create Dataset when the result is correct.
Selected monthly columns and the Pivot Longer preview in DataCello
Selected monthly columns and the Pivot Longer preview in DataCello

Validate the result

Ten products across twelve month columns normally produce 120 rows, including missing cells. Confirm the product identifier remains, the original headers appear in the month field, and sales is numeric.

Current scope

  • Selected columns are stacked into name and value rows.
  • The source remains unchanged; the result can become a derived dataset.
  • Pivot Longer does not automatically turn month labels into real dates. Add date parsing afterward when needed.

DataCello for Mac

Try it with your own data.

Start by importing and inspecting your dataset.

Download on the Mac App Store