Skip to content

feat: add 'count' metric for pivot table #2885

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dsilva01
Copy link

@dsilva01 dsilva01 commented Feb 6, 2025

Summary

This PR adds support for the Count metric in PivotTable, allowing users to aggregate data based on the number of occurrences in a given field.
Currently, exceljs supports sum metric , but count is a widely used aggregation method in Excel that was missing.
This enhancement aligns PivotTable functionality more closely with native Excel behavior.

Test plan

  • Added unit tests to validate the correct behavior of the Count metric in different scenarios.
  • Manually tested by generating an Excel file and verifying the PivotTable results in Excel.
  • Ensured backward compatibility with existing metric calculations.

The PR includes a new unit test file, pivot-tables-with-count.spec.js, with tests for valid and invalid the count metric. All unit tests, including the new tests and all existing tests, pass when running "npm run test:unit".

Related to source code (for typings update)

👉 Feedback and discussion #2575.

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