Database Reference
In-Depth Information
rows. Because the dataset does not include the last two weeks of 2013, the first
moving average value of 1,572,999.333 is the average of the first three weeks of
2014: the current week and the two subsequent weeks. The moving average value
for the second week, 1,579,941.75, is the sales value for week 2 averaged with the
prior week and the two subsequent weeks. For weeks 3 through 24, the moving
average is based on the sales from 5-week periods, centered on the current week.
At week 25, the window begins to include fewer weeks because the following weeks
are unavailable. Figure 11.3 illustrates the applied smoothing process against the
weekly sales figures.
Figure 11.3 Weekly sales with moving averages
Built-in window functions may vary by SQL implementation. Table 11.3 [1] from
the PostgreSQL documentation includes the list of general-purpose window
functions.
Search WWH ::




Custom Search