Problems / Unpivot Revenue and Units / Editorial
SELECT
revenue
units
UNION ALL
DataFrame.union
Wide formats smuggle data into metadata — the quarter lives in column names, invisible to WHERE, GROUP BY, or joins — and unpivoting is the act of moving it back into values. With multiple measure groups the operative concept is the unpivot grain: decide what one output row means (product-quarter) and make every branch deliver all measures for that grain at once. Unpivot measures separately and you pay for it immediately — NULL-padded rows or a self-join to reassemble what one pass of UNION ALL had for free.
WHERE
GROUP BY
Solve Unpivot Revenue and Units yourself →