Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Sep 27, 2004

MDX in Analysis Services: Mastering Time: Moving Averages - Another Approach

By William Pearson

About the Series ...

This article is a member of the series MDX in Analysis Services. The series is designed to provide hands-on application of the fundamentals of MDX from the perspective of MS SQL Server 2000 Analysis Services; our primary focus is the manipulation of multidimensional data sources, using MDX expressions, in a variety of scenarios designed to meet real-world business intelligence needs.

For more information on the series, as well as the hardware / software requirements to prepare for the tutorials we will undertake, please see the first lesson of this series: MDX Concepts and Navigation.

Note: At the time of writing, Service Pack 3 / 3a updates are assumed for MSSQL Server 2000, MSSQL Server 2000 Analysis Services, and the related Books Online and Samples. Images are from a Windows 2003 Server environment, upon which I have also implemented MS Office 2003, but the steps performed in the articles, together with the views that result, will be quite similar within any environment that supports MSSQL Server 2000 and MSSQL Server 2000 Analysis Services ("Analysis Services" or "MSAS"). The same is generally true, except where differences are specifically noted, when MS Office 2000 and above are used in the environment, with respect to any MS Office components presented in a given article.


In this article, we return to the subject of the previous article in the series, Mastering Time: Introduction to Moving Averages, and examine another approach for achieving "rolling average" aggregations. As we learned in our last article, "rolling," or "moving," averages, form a common business requirement, and involve a the aggregation of an average over a progressively moving window of time periods. While the functions that define the "window" involve the Time dimension in the vast majority of cases, we should be aware that we can apply these functions to members of other dimensional levels, as well.

We stated, in the previous session, that rolling averages are popular in the business community because they have the effect of smoothing values that fluctuate over time; we gave examples of useful applications of moving averages (such as cases where seasonal variations and other volatility factors come into play for a given measure), and then discussed some of their uses. We noted that the assistance moving averages offer in spotting trends (especially helpful in volatile markets, but in many other environments, as well), make moving averages a popular tool among technical analysts, as well as a commonly used contributor to many other technical indicators and overlays.

We broke down the concept of a rolling average, and explained that it is generated simply by calculating the average of the current value, together with the specified number of previous values, typically identified by their placement at time intersects. We noted that MDX affords multiple approaches to generating rolling averages, and we explored one of these through a multi-step practice example.

In this article, we will present a different approach, but will attempt to activate the underlying concept in a similar set of procedural steps. With each step, we will discuss our objectives, as well as the results we obtain. We will:

  • Discuss considerations applicable to our alternative approach, commenting upon the general steps of the practice example;
  • Examine the hypothetical business requirement from our last article, in which a group of information consumers have requested a particular moving average capability for analysis purposes;
  • Construct and test, within the Sample Application, the MDX required to support a rolling average calculated member;
  • Refer to the relevant section in our previous article for guidance in creating a calculated member in Analysis Manager, to provide a basis for verifying accuracy of operation, as well as for "permanent" structural rolling average support in the cube.

MS SQL Archives

Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM