Skip to content

fix: avoid NaN in pivot table AVERAGE totals - #1866

Open
janhenrikoverland wants to merge 1 commit into
masterfrom
fix/total-subtotal-nan
Open

janhenrikoverland wants to merge 1 commit into
masterfrom
fix/total-subtotal-nan

Conversation

@janhenrikoverland

Copy link
Copy Markdown
Contributor

Pivot tables with reporting rates show NaN in all totals.

The response has `factor: 100` but empty `multiplier` and `divisor`, so the AVERAGE total ends up as `x * undefined` = NaN.

Changes

  • When `multiplier` is missing, use `factor` as multiplier and `1` as divisor (per value, before summing into the totals)
  • If an AVERAGE total still can't be computed, show N/A instead of NaN
  • Parse the data fields once per value instead of once per total cell

Note

This makes the Reporting rate totals correct, but Actual reports and Expected reports totals are still wrong because the backend returns `totalAggregationType: AVERAGE` for them (they should be `SUM`). The backend should also return `multiplier`/`divisor` for reporting rates. That needs a backend fix.

🤖 Generated with Claude Code

Reporting rates come back with a factor but empty multiplier and
divisor, which made all AVERAGE totals NaN. Fall back to the factor
when multiplier is missing, and show N/A instead of NaN when the total
still can't be computed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

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