Skip to content

Commit 33fef3a

Browse files
authored
Update multi-stage-calculations.mdx
1 parent 8cc6346 commit 33fef3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/pages/product/data-modeling/concepts/multi-stage-calculations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ For example, comparing revenue sales to the overall average:
242242

243243
- name: revenue_per_city_sq_feet
244244
multi_stage: true
245-
sql: "{revenue} / NULLIF({occupied_sq_feet_per_city}, 0)"
245+
sql: "CASE WHEN {occupied_sq_feet_per_city} = 0 THEN NULL ELSE {revenue} / (CASE WHEN {occupied_sq_feet_per_city} = 0 THEN 0.1 ELSE {occupied_sq_feet_per_city} END) END"
246246
type: number
247247
```
248248
@@ -379,4 +379,4 @@ Query and result:
379379
380380
[link-tesseract]: https://cube.dev/blog/introducing-next-generation-data-modeling-engine
381381
[ref-measures]: /product/data-modeling/concepts#measures
382-
[ref-dimensions]: /product/data-modeling/concepts#dimensions
382+
[ref-dimensions]: /product/data-modeling/concepts#dimensions

0 commit comments

Comments
 (0)