-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(docs): Remove AI instructions to multiply percentage metrics by 100 #10607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,7 +38,7 @@ const createPercentageMeasure = (status) => ({ | |||||||||||||||
| sql: (CUBE) => | ||||||||||||||||
| `ROUND(${CUBE[`total_${status}_orders`]}::NUMERIC / ${ | ||||||||||||||||
| CUBE.total_orders | ||||||||||||||||
| }::NUMERIC * 100.0, 2)` | ||||||||||||||||
| }::NUMERIC, 2)` | ||||||||||||||||
|
Comment on lines
39
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same precision concern as the mintlify version —
Suggested change
|
||||||||||||||||
| } | ||||||||||||||||
| }) | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ const createPercentageMeasure = (status) => ({ | |||||
| format: `percent`, | ||||||
| title: `Percentage of ${status} orders`, | ||||||
| sql: (CUBE) => | ||||||
| `ROUND(${CUBE[`Total_${status}_orders`]}::numeric / ${CUBE.totalOrders}::numeric * 100.0, 2)`, | ||||||
| `ROUND(${CUBE[`Total_${status}_orders`]}::numeric / ${CUBE.totalOrders}::numeric, 2)`, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same precision concern as the docs:
Suggested change
|
||||||
| }, | ||||||
| }); | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential precision loss: With the old code,
ROUND(ratio * 100.0, 2)gave 2 decimal places in the percentage space (e.g.,33.33). NowROUND(ratio, 2)rounds the raw ratio to 2 decimal places (e.g.,0.33), and d3's.2%format will display it as33.00%instead of33.33%.Since the
format: percent(d3.2%) already handles rounding when displaying,ROUNDis arguably unnecessary now. But if you want to keep it for clean SQL output, consider increasing the precision: