How I built a cube with dbt, DuckDB and the Activity Schema
Amazing article !! I was looking for single table models for metrics, and this seems to be the easiest to build.
I am curious how would you handle cases where you want multiple dimensions in the cube ? Say segment and product category ?
Thanks. For multiple dimensions, the macro should be able to handle it. You add them to the JSON blob and expose them in the CTE that prepares the data. Here’s an example: https://github.com/Levers-Labs/SOMA-B2B-SaaS/blob/main/models/growth_accounting/base_metrics/ga_cube_contraction_revenue.sql
..."For orientation, anything to the left of a node is considered “downstream” and everything to the right of a node “upstream” like a river flowing left to right."...
I think it's the opposite.
Great article, btw.
Ah you’re quite right
Amazing article !! I was looking for single table models for metrics, and this seems to be the easiest to build.
I am curious how would you handle cases where you want multiple dimensions in the cube ? Say segment and product category ?
Thanks. For multiple dimensions, the macro should be able to handle it. You add them to the JSON blob and expose them in the CTE that prepares the data. Here’s an example: https://github.com/Levers-Labs/SOMA-B2B-SaaS/blob/main/models/growth_accounting/base_metrics/ga_cube_contraction_revenue.sql
..."For orientation, anything to the left of a node is considered “downstream” and everything to the right of a node “upstream” like a river flowing left to right."...
I think it's the opposite.
Great article, btw.
Ah you’re quite right