0
votes

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

1
not clear what you're trying to do, but give this a try: drag Date1 to the Rows shelf and change it to month. drag Records to the Text card. the result is something like what you describe, with no formulas needed. and by the way, you have two dates that are 2010 instead of 2020.jdigital
Hey i know this, so i need this for some other reasons , to colour and label the points with specific dates only. Can you please tell the formula waynoob

1 Answers

3
votes

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))