不能混合聚合和非聚合参数 Tableau

Cannot mix Aggregate and Non Aggregate Arguments Tableau

我有以下数据:

Date1         Records                    
26-03-2020     22
21-03-2020     10
25-07-2020     5
21-03-2010     12
31-01-2020     13
01-01-2020     11
05-09-2010     04

所以我正在尝试创建一个计算参数,这样

if year(Date1) = 2020 and month(Date1) in ('Jan', 'Feb' ,'Mar', 'Apr', 'May') then count(records)
end

预期输出

Date1         Records                    
Mar-2020      32    #22+10
Jan-2020      24    #13+11
Jul-2020      5         

Error: Cannot mix Aggregate and Non Aggregate Arguments

试试这个:

count(if year(Date1) = 2020 and month(Date1) in ('Jan', 'Feb' ,'Mar', 'Apr', 'May') then [records] end)

我认为 IN 仅适用于最新版本的画面。因此,替代公式可以是:

SUM(INT(YEAR([Date])=2020 AND MONTH([Date])<6))