Reputation: 3811
I have the following data:
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
So I am trying to create a calculated parameter such that
if year(Date1) = 2020 and month(Date1) in ('Jan', 'Feb' ,'Mar', 'Apr', 'May') then count(records)
end
Expected output
Date1 Records
Mar-2020 32 #22+10
Jan-2020 24 #13+11
Jul-2020 5
Error: Cannot mix Aggregate and Non Aggregate Arguments
Upvotes: 0
Views: 486
Reputation: 1735
try this:
count(if year(Date1) = 2020 and month(Date1) in ('Jan', 'Feb' ,'Mar', 'Apr', 'May') then [records] end)
IN only works in the latest version of tableau I think. Therefore, an alternative formula could be:
SUM(INT(YEAR([Date])=2020 AND MONTH([Date])<6))
Upvotes: 3