Rather than the quick running functions Tableau offers you, you might want to create your own Calculated Field that does a running sum / specific count:
RUNNING_SUM(SUM([Sales])) / [Week]
I'm not sure if your Week field is a DateField and you're SHOWING week (e.g., 1/5/2012 would show Week 1, 1/17/2012 would show Week 3) or if it's actually a field in your data that shows "3"
If it's a Date field, you would want to use DATEPART('week',[DateField]) instead of [Week] in the formula above.
Hope that helps!
Thanks for the help!
The underlying dataset has no row in the spot in question. So I can't seem to get the denominator to be a "3." I tried doing the calculation the way suggested above using max(datepart('week',[closedate])) to get the week # and the doing division. However, in the category in question since there is no row for Midwest sales in week 3 it's using the week 2 number for division.
Any other thoughts on this are appreciated. Thanks.
Tableau pads out dates across dimensions - "pads the domain" is the term the developers use - when table calculations are in use, which is why you're even seeing a row for Midwest on 1/15. But it only pads and generates results for table calculations. So, if you wrap the DATEPART('week',[DateField]) that Mark suggested inside a table calculation that will return a result for every row in the partition - such as WINDOW_MIN(ATTR(DATEPART('week',[DateField]))) - then you can get a week number that you can use for the divisor. I set this up in the attached. Note that the YTD Weekly Average is a nested table calc, with Compute Using set to Date for the YTD Total and Region for the the YTD Weekly Average.
padding running average.twbx.zip 29.8 KB