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

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

Posted Sep 8, 2003

MDX Essentials - MDX Time Series Functions, Part III: The LastPeriods() and ParallelPeriod() Functions

By William Pearson

About the Series ...

This is the eleventh article of the series, MDX Essentials. The primary focus of this series is an introduction to MDX. The series is designed to provide hands-on application of the fundamentals of the Multidimensional Expressions (MDX) language, with each tutorial progressively adding features designed to meet specific real-world needs.

For more information about the series in general, as well as the software and systems requirements for getting the most out of the lessons included, please see the first article, MDX at First Glance: Introduction to MDX Essentials.

Note: Service Pack 3 updates are assumed for MSSQL Server 2000, MSSQL Server 2000 Analysis Services, and the related Books Online and Samples.

What We Accomplished in our Last Article

In the tenth article of the series, MDX Time Series Functions, Part II: The OpeningPeriod() and ClosingPeriod() Functions, we continued our introduction to the time series functions group, noting that MDX provides this specialized group of functions to perform analysis within the context of time. After discussing the common business need to analyze data over time, and, more specific to our lesson, within a scope of the opening or closing periods of a given time window, we examined the OpeningPeriod() and ClosingPeriod () functions in detail. In the case of each, we illustrated the syntax that is appropriate for its effective use, and then tested our understanding of how to leverage the function by undertaking a relevant practice exercise.

As has been the case with numerous functions in past lessons, we revisited the construction of a calculated member, building a calculated measure within our practice queries as a vehicle for illustrating the operation of the OpeningPeriod() and ClosingPeriod () functions. Finally, we discussed the results that each practice example obtained, comparing the results of the ClosingPeriod () function with the OpeningPeriod() function to emphasize their similarity in construction and operation.

In this lesson, we will introduce two remaining time series functions, LastPeriods() and ParallelPeriod(). Like the other members of this specialized functions group, these functions support the common business requirement to produce results in reference to time; another characteristic that they have in common with the rest of the time series functions is that, while they are typically used with time-type dimensions, they can be applied to non-time dimensions, too.

Introduction

In our introductory comments in MDX Time Series Functions, Part I: PeriodsToDate() and Kindred Functions, we discussed the fact that most of us have become acquainted with the need to perform data analysis from the perspective of time. We mentioned that examples abound, including business requirements to analyze growth (for instance in revenues or expenses) over periods in time (say, between the years 1997 and 1998). We also touched upon other examples, such as the presentation of year-to-date totals, averages or other accumulations. We noted that the primary mission of the time functions is to navigate within the time dimension, thus supporting our analytical needs within a time context.

We learned that the time series functions can be applied to non-time dimensions, but that, by and large, they are specifically designed to support time-based analysis. These functions stand ready to enable us to easily navigate within the time dimension, as we pointed out, to such places as "this month last year," "the first month in the quarter," or "our current point in the year, last year."

Along with an introduction to the LastPeriods() and ParallelPeriod() functions, this lesson will include:

  • an examination of the syntax surrounding the use of each function;
  • an illustrative example of the use of each function in a practice exercise;
  • a brief discussion of the MDX results we obtain in each practice example.


MS SQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




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