Big Bad Budha
Big Bad Budha

Reputation: 3

Exclude current week in Tableau automatically

I have set of data that is automatically updated each day with new lines. On the other hand my graphs shows weekly/monthly data.

Is there any way to exclude current week/month, so that the graph can be automatically updated on the server, without me manually excluding and including weeks/months each time I have data for full week/month?

Upvotes: 0

Views: 8073

Answers (3)

HambSammich
HambSammich

Reputation: 11

make a copy of your date field. Drop on filter, select condition tab, select by formula and drop this in the field:

datetrunc('week',[Order Date (copy)]) <> datetrunc('week',today())

Upvotes: 1

Ben P
Ben P

Reputation: 3369

Here's another option which I use regularly in my reports.

  1. Index your date field by week, with a calculated field: STR(DATEDIFF('week', [Date], today(), 'monday'))

Note that here I have specified my weeks start on Monday, your requirement may be different.

  1. Drag this field onto filters and exclude the value 0, as in the index the current week will always be 0, last week will be 1 etc.

enter image description here

Upvotes: 3

S. User18
S. User18

Reputation: 712

This is an untested example of a calculated field to exclude current week:

IF DATETRUNC('week',[your date field]) = DATETRUNC('week',NOW()) THEN
    'filter me'
ELSE
    'leave me'
END

Drag that calculated field to filters. In case you couldn't guess, exclude the 'filter me' value :)

Upvotes: 1

Related Questions