表格计算的百分比

时间:2017-08-15 17:08:59

标签: tableau

我试图根据下表计算流失率: enter image description here

例如,1月有22个条目,第1个月有4个条目。我希望百分比符合逻辑:

  1. 1 - 4/22 = 0,81
  2. 1-4 / 22 - 1/22 = 0,77
  3. 在Tableau中,我创建了一个计算字段:

        1 - 
    
    SUM([Number of Records]) / TOTAL(SUM([Number of Records]))
    
    - ZN(LOOKUP(SUM([Number of Records]) / TOTAL(SUM([Number of Records])), -1))
    

    但它仅适用于前2个月: enter image description here 任何想法如何使其工作?

1 个答案:

答案 0 :(得分: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
相关问题