Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一列有很多行,但只有两个值,A 和 B:
我试图只计算带有 A 的行但没有成功 - 在仪表板的汇总计算中(没有为此特定计算创建新列)给我语法错误的表达式是这样的:
计数([列] = 'A')
有什么建议吗?
您需要使用 if then else 构造:
count( if([Column]='A') then ([Column]) else (Null))
您可以使用 IF-THEN-ELSE 或 CASE-WHEN-THEN-ELSE 创建自己的计数:
sum( if ([Query Item] = 'A') then (1) else (0) )
或者
sum( case when [Query Item] = 'A' then 1 else 0 end )