4 Comments
Sep 4, 2023Liked by Ergest Xheblati

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
author

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
Apr 26, 2023Liked by Ergest Xheblati

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

Ah you’re quite right

Expand full comment