4 Comments

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 ?

Expand full comment

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

Expand full comment

..."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.

Expand full comment

Ah you’re quite right

Expand full comment