Reshaping Time-Series Data
Use these when your data is time-stamped and you need to change its shape — for example, from a tall narrow table to a wide one, or vice versa.
Long to Wide — DF_TIME_SERIES_LONG_TO_WIDE
Turn a "long" table (one row per timestamp + metric) into a "wide" table (one column per metric, one row per timestamp).
Use this when: your data has a metric column with names like temperature, humidity, co2, and a single value column — and you want each metric to have its own column so you can plot them on the same chart.
Before (long format — one row per reading)
Code
After (wide format — one column per metric)
Code
Code
Wide to Long — DF_TIME_SERIES_WIDE_TO_LONG
The reverse of Long to Wide — turn a "wide" table into a "long" one.
Use this when: your data has one column per metric but you need a single metric and value column format, for example to feed into a chart that expects long format.
Before (wide format)
Code
After (long format)
Code
Code
Time Series to Rows — DF_TIME_SERIES_TO_ROWS
Collapse an entire time series down to a single summary row.
Use this when: you want one headline value for a time series — like the last recorded reading, or the total across all time points — rather than plotting every row.
Available aggregations: sum, avg, min, max, count, first, last.
Before
Code
After — last value only
Code
Code
Time Series to Table — DF_TIME_SERIES_TO_TABLE
Flatten time-series data into a plain table layout, ready for a Table panel.
Use this when: you have time-series data but want to display it as a straightforward table rather than a chart — every timestamp and value as ordinary rows and columns.
Before
Code
After — a flat table keyed on the time field
Code
Code