简体   繁体   English

显示差异而不是总计 - NReco 数据透视表

[英]Show Difference instead of Grand Total - NReco Pivot Table

I have a scenario where I will be showing only two rows (say A, B).我有一个场景,我将只显示两行(比如 A、B)。 By default, NReco always shows the Grand Total(A+B) as the last row.默认情况下,NReco 始终将总计 (A+B) 显示为最后一行。 I would like to have Difference (AB) instead of Grand Total.我想要差异 (AB) 而不是总计。

How I can achieve this?我怎么能做到这一点?

Grand total calculation in the pivot table relies on the aggregate function, so if you use, say, SumAggregatorFactory it total for A and B shows A+B.数据透视表中的总计计算依赖于聚合函数,因此,如果您使用SumAggregatorFactory则 A 和 B 的总计显示 A+B。 You can implement your own aggregate function for your own logic to achieve the desired grand total value.您可以为自己的逻辑实现自己的聚合函数,以实现所需的总计值。 It is unclear what exactly you want to achieve as AB definitely depends on the rows order, but aggregate function should NOT rely on the order - so maybe your table is not a pivot table at all?..目前尚不清楚您究竟想要实现什么,因为 AB 绝对取决于行顺序,但聚合函数不应依赖于顺序 - 所以也许您的表根本不是数据透视表?..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM