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.36k stars 1.08k forks source link

Count as Fraction of Total with Weighted Data #1212

Open forceofnight opened 4 years ago

forceofnight commented 4 years ago

I am looking to be able to include weighting into the calculations for each of my records. I was wanting to us the 'Count as Fraction of Total' options to achieve this and I am trying to figure this out.

I am basically wanting to implement this equation. With the numerator being for each individual record and the denominator being the total amount of records. SUM([Weight]) / TOTAL(SUM([Weight]))

nicolaskruchten commented 4 years ago

I believe that the sum-over-sum operator is what you're looking for