Think of dimensions as virtual columns or fields in your data model. If you were to do a GROUP BY
in SQL, the columns in the GROUP BY
part are the dimensions.
Whereas, measures are the aggregation part of a GROUP BY
.
Another way to think of dimensions and measures is:
dimensions you can typically imagine on the x-axis of a bar or line chart
measures you can typically imagine on the y-axis.
Some examples:
SELECT
"country" AS "my country",
SUM("price") AS "total price"
FROM orders
GROUP BY 1
SELECT
COUNT(*) AS "my count"
AVG("price") as "average price"
FROM orders
SELECT
DATE_TRUNC('week', "created_at") AS "Week",
MAX("created_at") as "Last order time"
FROM "orders"
GROUP BY 1
ORDER BY 1 DESC
Detailed documentation on how to define dimensions and measures in Cube can be found in their official documentation here: