forums

Use these forums to ask questions and discuss Tableau.

Calculating moving averages based on days instead of populated data points

How can I create a calculated moving average that is based on the number of days instead of populated data points? More specifically, I'm trying to calculate a 30-day moving average. However, not every day has a value. Currently, Tableau quick calculations will use the most-recent 30 data points to calculate the average. I want a moving average that calculates the last 30 days (using zero for the days that have no data).

Any ideas?

Thanks.

Comments

Currently the only way to handle this is to add the missing days to your data set. We're looking into how we can be smarter about dates so that you get the behavior you are looking for.

:)ross

Hum, I am also trying to calculate a moving 30 day average. Is there a formula or logic that you might have that you can share. I've tried different formulas calculation and have come up with nothing.

Thanks,
Arron

Arron,

Have you looked at Tableau's table calculations? You can add a table calculation by right-clicking a measure in the view and selecting Add Table Calculation. In the subsequent dialog box select Moving Calculation as the type. Then you can select from several options to define the calculation.

--Erin

Yes, i have looked at the moving calculation table. I guess i don't fully understand the previous values and next values. Are these Months or days? Any Ideas?

-Arron

Hello All,

Here is a 30 day rolling calculation formula, please let me know if you get vexed. I know i was at first.
-------------------------------------------------------------------------------------
DaysOld

Role: Continuous Dimension
Type: Calculated Field
Status: Valid

Formula
datediff("day",[RollUpdate],now())

The domain for this field has not been loaded. Click "Load" to retrieve.
---------------------------------------------------------------------------------------

Enjoy,
-Arron

Hi - I'm also trying to use a 30 day (or sometimes 7 day) both rolling average and a rolling sum. I didn't understand in your forumula what RollUpdate means, and how you then use DaysOld (which I'm assuming is the title to the calc). Do you have an example workbook - that might be the simplest way to see how it works (or even a couple of jpeg images of the calculation setup and how you're using it).....

Thanks!
Jeff

Syndicate content Subscribe to the comments on "Calculating moving averages based on days instead of populated data points"