Need more detail.
And a sample workbook would really help out here.
When you want to show "last 7 days", for example, do you want 7 dates on the axis? Or do you want to grab a sum of the last 7 days on each mark -- for example on Oct 10 you would show a sum from Oct 4-10, and on Oct 11 would be a sum from Oct 5-11, etc.?
The slider for a date range -- is that a filter? If it is, you will chop off all dates before the min date, and if you want to show a sum of prior 7 days, there will be no records for them in the underlying table.
A working example would help so we can play with what you have and help you create what you want.
Last 7 days of Sales is what I want to show each day as a individual data point with respective sales.
yes slider for date range is a filter. Wondering if this is possible.
A sample workbook would really help.
There is a table calc function called WINDOW_SUM() that lets you sum up a series of marks. If you don't specify a starting offset and ending offset, it does the whole table. But you can do this:
WINDOW_SUM( SUM([Sales]), -6, 0 )
And that will add up 7 days (prior 6 plus current). You can also use variables in the offset arguments.
So you can set a variable based on which parameter value the user selected and use that for the first offset.
As for the slider, if you use a table calc as your filter, you won't throw away the rows in the underlying table, which would leave them available to use in the WINDOW_SUM calc.
These things are far easier to show in an actual example than to describe. If my description above gets you going, then cool! But if you need help setting them up, I'll need a sample workbook to show you in.
If you are concerned about posting proprietary data here, then check out this video:
Joe I attached the sample work book above. If you could create the parameter just showing last 3 months that would be great. Its pretty much exact to what's in my actual workbook.
(V 10.2 here)
In the attached I created a parameter [Select a range] and put it on the sheet. I created a calc to set the offset in the window_sum based on the value of the parameter. [How far to look back?]. I used that offset in the Window_sum table calc. [Rolling sales]. On this sheet both Sun(sales) and [Rolling Sales] are displayed in text format so you can see what the calc is doing. No filter yet. This shows all data. You'll notice that for the first 6 days it sums up like a running sum because on day 2 there are only two days to add up.
On Sheet 2(2) I added a filter calc that uses a table calc. The LOOKUP function tells tableau to look at offset (whatever) to get the requested value. When I use offset 0, it says "look right in this cell!" When I use this calc as a filter, Tableau actually gives me full filter behavior, and I can make a slider with it. But the cool thing about a table calc filter is that it doesn't eliminate rows from the underlying table like a quick filter does. So if you look at 1/10/2013, for example, you see that the rolling value is 4914. If you set the min value in the filter to 1/1/2013, the rolling value for that date is still 4914 because all the rows in the underlying table are still in there.
Sheet 2(3) is just a line chart of the same data.
fake data_v10.2.twbx 1.2 MB