Skip to content

feat: add configurable pivot totals for Explore and Canvas#9520

Open
djbarnwal wants to merge 13 commits into
mainfrom
feat/hide-totals-pivot
Open

feat: add configurable pivot totals for Explore and Canvas#9520
djbarnwal wants to merge 13 commits into
mainfrom
feat/hide-totals-pivot

Conversation

@djbarnwal
Copy link
Copy Markdown
Member

@djbarnwal djbarnwal commented Jun 3, 2026

Adds support for toggling pivot/flat table totals across Explore and Canvas.

Changes

  • Added row and column total visibility state to shared pivot table rendering.
  • Added Explore toolbar controls for Total row and Total column.
  • Persisted Explore total visibility through URL state and dashboard proto state.
  • Added Canvas component properties:
    • hide_totals_row
    • hide_totals_col
  • Updated Canvas inspector controls to show totals options only when they affect the table.
  • Updated Canvas schema, docs, and AI resource examples.
  • Fixed hidden-total edge cases around:
    • page refresh persistence
    • nested row expansion offsets
    • first-column column-dimension headers
    • sticky totals-row virtualization
    • stale Canvas pivot pagination/active-cell state
image

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@djbarnwal djbarnwal requested a review from AdityaHegde June 3, 2026 15:58
@nishantmonu51
Copy link
Copy Markdown
Collaborator

@djbarnwal : Can you also confirm it doesn't query totals as well when its hidden ?

@nishantmonu51
Copy link
Copy Markdown
Collaborator

UX issues -

  1. For Flat table we don't have a Total Column, should we remove the option when selecting flat table ?
  2. When selecting pivot table - Hide total rows isn't working
  3. The order of Hide rows and columns options is reversed in flat and pivot tables.
  4. there is no label shown for Total column in pivot view, which is confusing
Screenshot 2026-06-04 at 12 37 21 PM 5. When hiding totals for both rows and columns, I see same API calls being made to platform, Can we optimize and not do aggregation calls to fetch totals when they are not being shown ? 6. On every table load there is a cancelled aggregation API call, we need to avoid that.

@AdityaHegde
Copy link
Copy Markdown
Collaborator

Looks good from code POV

@djbarnwal
Copy link
Copy Markdown
Member Author

Re: query optimization

  1. globalTotalsQuery — gated with the recent commit

  2. totalsRowQuery — not gated, intentionally
    Fetches per-(column-dimension, measure) totals. Despite the name, its result is load-bearing for the main table rendering and not just the totals row display. We use this to determine the column order for the column dimensions

  3. Row-totals column (right-hand "Total" column) — no separate query
    Already gated by showTotalsColumn. No backend query is dedicated to this column. Its values are derived from the existing table cell data, so there's nothing to skip on the network side.

@djbarnwal
Copy link
Copy Markdown
Member Author

  1. For Flat table we don't have a Total Column, should we remove the option when selecting flat table ?

Yes, made the Hide Totals row and hide totals column options dynamic

  1. When selecting pivot table - Hide total rows isn't working

Fixed

  1. The order of Hide rows and columns options is reversed in flat and pivot tables.

Now we only show the "Hide totals row" option for flat table

  1. there is no label shown for Total column in pivot view, which is confusing

Yeah we chose to not have it in our initial design. Do you think we should add a "Total" label similar to the row header and put it in bold?

  1. When hiding totals for both rows and columns, I see same API calls being made to platform, Can we optimize and not do aggregation calls to fetch totals when they are not being shown ? 6. On every table load there is a cancelled aggregation API call, we need to avoid that.

Would need to check on cancelled API calls, address the query optimization in the above comment.

@djbarnwal djbarnwal requested a review from nishantmonu51 June 5, 2026 09:48
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.

3 participants