Skip to content

fix: correct weightCol for percentage change aggregations in DataTable docs#3279

Open
wrathagom wants to merge 1 commit intoevidence-dev:mainfrom
wrathagom:fix/datatable-weightcol-docs
Open

fix: correct weightCol for percentage change aggregations in DataTable docs#3279
wrathagom wants to merge 1 commit intoevidence-dev:mainfrom
wrathagom:fix/datatable-weightcol-docs

Conversation

@wrathagom
Copy link

Description

re: #2592

Fixes incorrect weightCol values in DataTable documentation examples for percentage change aggregations.

When using totalAgg=weightedMean for percentage change columns, the weightCol should reference the baseline/previous value column, not the current value. This is because percentage changes are calculated relative to the original value (e.g., (new - old) / old).

Changes:

  • Example project fix (sites/example-project/src/pages/tables/total-rows/+page.md):

    • sales_change_pct0: weightCol=sales_usd0k → weightCol=prev_sales_usd0k
    • num_orders_change_pct0: weightCol=sales_usd0k → weightCol=prev_num_orders_num0
    • aov_change_pct0: weightCol=sales_usd0k → weightCol=prev_aov_usd2
  • Documentation tip (sites/docs/pages/components/data/data-table/index.md):

    • Added a tip box in the Total Row section explaining the correct usage of weightCol for percentage change aggregations

Checklist

  • For UI or styling changes, I have added a screenshot or gif showing before & after
  • I have added a changeset
  • I have added to the docs where applicable
  • I have added to the VS Code extension where applicable

…e docs

- Update example-project total-rows page to use prev_* columns as weightCol
  for percentage change columns (sales_change_pct0, num_orders_change_pct0,
  aov_change_pct0)
- Add tip in DataTable documentation explaining that weightCol should be
  the baseline/previous value when aggregating percentage changes

Co-Authored-By: Caleb Keller <calebmkeller@gmail.com>
@wrathagom wrathagom requested a deployment to Approval required to run action on external PR February 9, 2026 20:02 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments