【发布时间】:2020-11-17 16:31:53
【问题描述】:
我是 Tableau 新手,所以这一切可能都错了,我正在尝试创建一个计算字段来计算“已完成”任务的百分比。
我的数据看起来像
Date | Department | Task | Task Status | Number of Items
5/11 HR one one (complete) 5
5/11 HR one one (in progress) 3
5/11 HR one one (not started) 1
5/11 HR two two (complete) 3
5/11 HR two two (in progress) 6
5/11 HR two two (not started) 9
5/11 Finance one one (complete) 3
5/11 Finance one one (in progress) 2
5/11 Finance one one (not started) 8
我正在尝试计算每个部门已完成任务的百分比,例如在 HR 中,8/27 任务已完成。该数据每周更新一次,所以我想知道最近的日期。只有2个任务。到目前为止我所拥有的是
IF [Date] == #05/11#
THEN
SUM(IF [Task Status] == 'one (complete)' OR [Task Status] =='two (complete)' THEN [Number of Items]
END)
/SUM([Number of Items]
END
但是,它抛出“不能混合聚合和非聚合比较或导致 IF 表达式。”错误
谁能指出我正确的方向?
【问题讨论】:
标签: tableau-api calculated-field