Skip to content

Commit

Permalink
fix: only accumulate when total agg type is SUM
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Oct 18, 2024
1 parent 4414f42 commit 88e4ca6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/pivotTable/PivotTableEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,10 +1088,15 @@ export class PivotTableEngine {
column,
})
const valueType = dxDimension?.valueType || VALUE_TYPE_TEXT
const totalAggregationType =
dxDimension?.totalAggregationType

// only accumulate numeric (except for PERCENTAGE and UNIT_INTERVAL) and boolean values
// accumulating other value types like text values does not make sense
if (isCumulativeValueType(valueType)) {
if (
isCumulativeValueType(valueType) &&
totalAggregationType === AGGREGATE_TYPE_AVERAGE
) {
// initialise to 0 for cumulative types
// (||= is not transformed correctly in Babel with the current setup)
acc || (acc = 0)
Expand Down

0 comments on commit 88e4ca6

Please sign in to comment.