5 Replies Latest reply on Oct 10, 2013 12:27 PM by Shawn Wallwork

# Calculate current weekly total ( automatic update )

Hi

I am trying to compute weekly totals.

For example, let's say today's date is 10/10.

When I open up a dashboard, I'd like to diplay daily totals of last week. (10/3~10/10)

This is what I want to display.

Day10/310/410/510/610/710/810/910/10
Number of Records100200300400500600700800

But I'd like to update it automatically with most recent data without manual filtering.

I created a calculated field called 'Current Date' and used today() to get current date.

Then I created 7 different fields, [Current Date]-7, [Current Date]-6, ..... [Current Date]-1

This gives me the display of last week's dates, but I couldn't find the records for each day.

Anyone have any idea?

Thanks!

• ###### 1. Re: Calculate current weekly total ( automatic update )

Is there a date field in your dataset? What's it called? Is it at the day level?

--Shawn

• ###### 2. Re: Calculate current weekly total ( automatic update )

It can expand up to minute level.

• ###### 3. Re: Re: Calculate current weekly total ( automatic update )

Jessica, so let's start over a bit. You don't need to use 7 calculation to produce the screenshot you posted. You're doing waaaay too much of Tableau's job. You're going to want to let T do most of the work. In the attached workbook I created this calculation:

[Order Date] > DATEADD('day', -7, TODAY() )

AND

[Order Date] < TODAY()    //This is only necessary if you have future dates like this data set does

[Sub in Load_Date for Order Date] As the note says you can delete that line if there aren't any future dates. Place this on the filter shelf and check true. Now you've got your last 7 days laid out for you without much work. Once you throw the number of records or sales figures or whatever into the viz your table is ready to go.

Hope this helps,

--Shawn

• ###### 4. Re: Re: Calculate current weekly total ( automatic update )

Wow I think I was thinking way to complicated.

This is exactly what I want.

Thank you so much !

• ###### 5. Re: Re: Calculate current weekly total ( automatic update )

You're welcome Jessica. Been there, done that -- in fact I still do it today. T gives us so many tools, at times it can be tough to pick the correct path.

Cheers,

--Shawn

PS: Thanks for the green star, I must be close to getting my last unclaimed badge.