【发布时间】:2021-02-10 05:52:10
【问题描述】:
有没有快速获取组中每个项目的比例/百分比的方法?现在,我首先按组计算值的总和,然后将这个总表合并到原始表中,然后计算比例。 Q 有快速计算这个函数吗?
day week item proportion
mon 1 2 20%
tue 1 7 70%
wed 1 1 10%
mon 2 1 25%
tue 2 2 50%
wed 2 1 25%
目前,我会这样做:
total: select total: sum item by week from table;
out: update proportion: item%total from table lj `week xkey total;
【问题讨论】:
标签: kdb