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 Jun 28, 2004

MDX in Analysis Services: Mastering Time: Period - to - Date Aggregations - Page 2

By William Pearson

Time and Accumulation

As we discussed in our last article, many business requirements revolve around the performance of analysis within the context of time. In performing virtually any type of data analysis with a cube, we are typically confronted with the need to do so with reference to time. In our last session, we discussed, and worked through a hands-on example surrounding, meeting a need to compare a measure or measures across months, quarters, or years. In addition to analyzing growth over periods in time, a need upon which we focused in Change across Periods, another need, familiar to most of us who have worked within accounting and finance circles, is the requirement to present year-to-date totals, averages or other accumulations.

Because of pervasive business needs to analyze data within the context of time, MDX provides a specialized group of time series functions to meet these and many other needs. The article MDX Time Series Functions, Part I: PeriodsToDate() and Kindred Functions, in my Database Journal MDX Essentials series, focuses in detail on the syntax and operation of the PeriodsToDate() function, together with the specialized "shortcut" functions that are based upon it, including the YTD(), QTD(), MTD(), and WTD() functions.

If you haven't read MDX Time Series Functions, Part I, it might act as a great syntopic reinforcement, either before or after completing this lesson, as examining concepts from multiple perspectives often tends to activate them more effectively. Following this approach, together with PhotoReading and other tools, helps me to master new material quickly. I heartily suggest it to anyone who shares my opinion that time (in general) is the only thing that is really important.

As we mentioned in our last article, MSAS provides excellent tools for presenting data within the relative time concepts so valued by information consumers, and the same applies within our examination of period-to-date concepts. The implements MSAS offers include:

  • Time dimension(s);
  • Alternate hierarchy capabilities;
  • MDX time-series functions;
  • Calculated members.

The PeriodsToDate() function, according to the Analysis Services Books Online, "returns a set of periods (members) from a specified level, starting with the first period and ending with a specified member." Within the scope of a level that is specified within the function, the function returns a set of periods that exist on the same level as the member that is also specified in the expression. In other words, it returns the number of periods within the specified level, up to and including the specified member. When no level or member is specified, the value of the member is Time.CurrentMember (a concept we have discussed earlier in our series), with the Level value being the parent level of Time.CurrentMember.

As we attempted to do in Mastering Time: Change across Periods, this article will treat the practical presentation of data with time as a consideration. While the specialized time-series functions are called upon, we will look at a combination of MDX elements to bring about the results we are called upon to obtain.

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