nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.33k stars 1.07k forks source link

Sum over Sum when using same count #1315

Open ausfas opened 1 year ago

ausfas commented 1 year ago

I'm trying to find the average which I have using sum over sum ( total cost/count). However, the count column has same values of each Payment category but the count total add the count and I don't get the right result. See below: image image image but I want the Sum over Sum such that averages are summed across column and sums across rows like here image

Its the total row and grand total that is throwing me out. If the count total is 40,30,20, 90 (instead of summing the values - which is in fact the right count of the category) then multiplying the sum over sum will get me the right results for the total at the end: 326.540=13060 540.2730=16208 405.120=8102 415.2290=37370

I tried custom aggregator https://github.com/nicolaskruchten/pivottable/issues/828 but can't return the total of row value and grand total based on sum. I ditched that option on favour of Sum over sum but still the same issue.