3 of 3 people found this helpful
Yes, it's kind of a hack - you use a special filter so that the filtering is done in Tableau after the moving average is calculated using a date filter calc of: lookup(min([Date]),0) The partitioning of this needs to be set to compute using [Date], not Table Across (right click the pill while on the filter, compute using). See the attached and note how the moving av does not change after you filter the second sheet.
Thanks Alex, this is helpful. It shows me how to solve one of the 2 problems I had - how to get the correct 3 week moving average when, on my sheet, I've filtered off the last 1 of 3 weeks. Wicked smaht.
Still stuck on the "tunnel view of the data" part. The best I can come up with is producing two new date calcs, one for the current date and one for the current date minus 2 weeks, then use reference lines to shade beyond the "current date" line and below the "current date minus 2 weeks" line.
The real fix I'm thinking of would prevent the user from even seeing what's to the right and left of those reference lines, zooming in on the 3 week range of data created by selecting a specific date through the date parameter and cutting off all data more than 2 weeks prior to that date. The key factor here is that the user will select a single date using a compact list with a discrete date in my filter and get this result. And yes, I know I can make it continuous with a range of dates and just slide the bar to get what I want, but the client wants the end-user to select only 1 pre-determined date from a drop down list to make this happen.
Anyone have any more suggestions to solve my moving average / date filter dilemma?
Hey ya'll I figured it out. It was as simple as creating a new boolean calc and adding that calc to my filters section where the only acceptable value is 1.
if date([Date]) <= [Date Current] and date([Date]) >= [Date Minus 2 Weeks]
then 1 else 0 end
To get the [Date Minus 2 Weeks] calc:
Not sure how much more I can share on here... but if you have any further questions let me know!