Add gmv aggregate#3180
Conversation
Signed-off-by: Andrew Stein <steinlink@gmail.com>
Signed-off-by: Andrew Stein <steinlink@gmail.com>
|
GMV = sum(abs(MV)). It's never negative. Rolling it up can be tricky depending on how you want to treat positions on the same names across multiple subgroups (ie net them or treat as separate). |
|
@nmichaud This implementation nets by the last The last column's aggregate is ... or y'all can change the spec (@timkpaine). |
|
Ok that makes sense. I wouldn't call it GMV, at least without calling out that you need to use it on an abs(x) column. |
This PR adds a new aggregate
gmv("gross market value"), which for any node in a Perspectivegroup_by/split_bytree:sum.|sum(child_subtree)|.The parent uses each child's raw signed sum, not the child's already-rolled-up
gmvvalue. This makes parent elements≠ Σ|child_gmv|.This specialized aggregation will be noticeably slower than regular
sumdue to recursively recalculatinggstatefor each depth, so use it wisely.