百分比表计算
问题描述:
我试图计算基于下表上的流失率: 百分比表计算
例如,有在1月22日的条目,4留在第一个月。我想有百分比以下逻辑:
- 1 - 4/22 = 0,81
- 1-4/22 - 1/22 = 0,77
在的Tableau创建计算字段:
1 -
SUM([Number of Records])/TOTAL(SUM([Number of Records]))
- ZN(LOOKUP(SUM([Number of Records])/TOTAL(SUM([Number of Records])), -1))
答
解决它自己
IF NOT ISNULL(SUM([Number of Records])) THEN
(TOTAL(SUM([Number of Records]))
- RUNNING_SUM(SUM([Number of Records]))
+ ZN(SUM([Number of Records])) - SUM([Number of Records]))/TOTAL(SUM([Number of Records]))
END