2
votes

I've got google analytics data for goal completions represented in a line graph in Tableau, with the week of the year as the x axis. What I need is to set a conditional filter on WEEK([Date]) so that all but the most recent week is shown. Something like this :

IF DATEPART('week',[Date]) < DATEPART('week',TODAY())
THEN 'Show'
ELSE 'Filter'
END

But when I try this, I get an error saying "The formula must be an aggregate calculation or refer only to this field" .

Could someone fix the formula for me?

1
I was able to replicate your scenario without error .minatverma

1 Answers

3
votes

Rather than trying to set this in the filter dialog box (I received the same error you experienced when trying to do it that way), use that formula to create a calculated field. Then simply drag that field to the filter box and filter on 'Show'.