Skip to content

Commit bca52d9

Browse files
fix(docs): remove multiplication by 100 in percentage measure examples (#10607)
- Updated documentation to use 1.0 * instead of 100.0 * for percentage calculations - Frontend now automatically multiplies by 100 when format: percent is used - Changed examples in getting started guides, recipes, and API documentation - Updated Funnels extension conversionsPercent measure - Updated test fixtures and example schemas - Kept decimal point multiplication (1.0 *) to ensure proper floating point division Resolves CUB-2081 Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 20404cb commit bca52d9

File tree

17 files changed

+27
-27
lines changed

17 files changed

+27
-27
lines changed

docs-mintlify/docs/data-modeling/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ measure via an API, the following SQL will be generated:
277277

278278
```sql
279279
SELECT
280-
100.0 * COUNT(
280+
1.0 * COUNT(
281281
CASE WHEN (users.paying = 'true') THEN users.id END
282282
) / COUNT(users.id) AS paying_percentage
283283
FROM users

docs-mintlify/docs/getting-started/cloud/create-data-model.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ within the `measures` block.
109109
```yaml
110110
- name: completed_percentage
111111
type: number
112-
sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
112+
sql: "(1.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
113113
format: percent
114114
```
115115

@@ -156,7 +156,7 @@ cubes:
156156
157157
- name: completed_percentage
158158
type: number
159-
sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
159+
sql: "(1.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
160160
format: percent
161161
```
162162

docs-mintlify/recipes/data-modeling/cohort-retention.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ cubes:
139139
- users.email
140140

141141
- name: percentage_of_active
142-
sql: "100.0 * {total_active_count} / NULLIF({total_count}, 0)"
142+
sql: "1.0 * {total_active_count} / NULLIF({total_count}, 0)"
143143
type: number
144144
format: percent
145145
drill_members:
@@ -168,7 +168,7 @@ cube(`monthly_retention`, {
168168
},
169169

170170
percentage_of_active: {
171-
sql: `100.0 * ${total_active_count} / NULLIF(${total_count}, 0)`,
171+
sql: `1.0 * ${total_active_count} / NULLIF(${total_count}, 0)`,
172172
type: `number`,
173173
format: `percent`,
174174
drill_members: [

docs-mintlify/recipes/data-modeling/event-analytics.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ cubes:
739739
- - sql: "{is_bounced} = 'True'
740740
741741
- name: bounce_rate
742-
sql: "100.00 * {bounced_count} / NULLIF({count}, 0)"
742+
sql: "1.0 * {bounced_count} / NULLIF({count}, 0)"
743743
type: number
744744
format: percent
745745
```
@@ -770,7 +770,7 @@ cube("sessions", {
770770
},
771771

772772
bounce_rate: {
773-
sql: `100.00 * ${bounced_count} / NULLIF(${count}, 0)`,
773+
sql: `1.0 * ${bounced_count} / NULLIF(${count}, 0)`,
774774
type: `number`,
775775
format: `percent`
776776
}
@@ -846,7 +846,7 @@ cube("sessions", {
846846

847847
repeat_percent: {
848848
description: `Percent of Repeat Sessions`,
849-
sql: `100.00 * ${repeat_count} / NULLIF(${count}, 0)`,
849+
sql: `1.0 * ${repeat_count} / NULLIF(${count}, 0)`,
850850
type: `number`,
851851
format: `percent`
852852
}
@@ -875,7 +875,7 @@ cubes:
875875

876876
- name: repeat_percent
877877
description: Percent of Repeat Sessions
878-
sql: "100.00 * {repeat_count} / NULLIF({count}, 0)"
878+
sql: "1.0 * {repeat_count} / NULLIF({count}, 0)"
879879
type: number
880880
format: percent
881881

docs-mintlify/recipes/data-modeling/using-dynamic-measures.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const createPercentageMeasure = (status) => ({
4141
sql: (CUBE) =>
4242
`ROUND(${CUBE[`total_${status}_orders`]}::NUMERIC / ${
4343
CUBE.total_orders
44-
}::NUMERIC * 100.0, 2)`
44+
}::NUMERIC, 2)`
4545
}
4646
})
4747

docs-mintlify/reference/core-data-apis/sql-api/query-format.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ cubes:
256256

257257
- name: completed_percentage
258258
type: number
259-
sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
259+
sql: "(1.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
260260
format: percent
261261
```
262262

docs/content/product/apis-integrations/core-data-apis/sql-api/query-format.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ cubes:
256256

257257
- name: completed_percentage
258258
type: number
259-
sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
259+
sql: "(1.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))"
260260
format: percent
261261
```
262262

docs/content/product/data-modeling/concepts/calculated-members.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ cube(`users`, {
158158
},
159159

160160
purchases_to_users_ratio: {
161-
sql: `100.0 * ${orders.purchases} / ${CUBE.count}`,
161+
sql: `1.0 * ${orders.purchases} / ${CUBE.count}`,
162162
type: `number`,
163163
format: `percent`
164164
}

docs/content/product/data-modeling/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ measure via an API, the following SQL will be generated:
283283

284284
```sql
285285
SELECT
286-
100.0 * COUNT(
286+
1.0 * COUNT(
287287
CASE WHEN (users.paying = 'true') THEN users.id END
288288
) / COUNT(users.id) AS paying_percentage
289289
FROM users

docs/content/product/data-modeling/recipes/cohort-retention.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ cubes:
139139
- users.email
140140

141141
- name: percentage_of_active
142-
sql: "100.0 * {total_active_count} / NULLIF({total_count}, 0)"
142+
sql: "1.0 * {total_active_count} / NULLIF({total_count}, 0)"
143143
type: number
144144
format: percent
145145
drill_members:
@@ -168,7 +168,7 @@ cube(`monthly_retention`, {
168168
},
169169

170170
percentage_of_active: {
171-
sql: `100.0 * ${total_active_count} / NULLIF(${total_count}, 0)`,
171+
sql: `1.0 * ${total_active_count} / NULLIF(${total_count}, 0)`,
172172
type: `number`,
173173
format: `percent`,
174174
drill_members: [

0 commit comments

Comments
 (0)