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

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.
William Pearson
Bill has been working with computers since before becoming a "big eight" CPA, after which he carried his growing information systems knowledge into management accounting, internal auditing, and various capacities of controllership. Bill entered the world of databases and financial systems when he became a consultant for CODA-Financials, a U.K. - based software company that hired only CPA's as application consultants to implement and maintain its integrated financial database - one of the most conceptually powerful, even in his current assessment, to have emerged. At CODA Bill deployed financial databases and business intelligence systems for many global clients. Working with SQL Server, Oracle, Sybase and Informix, and focusing on MSSQL Server, Bill created Island Technologies Inc. in 1997, and has developed a large and diverse customer base over the years since. Bill's background as a CPA, Internal Auditor and Management Accountant enable him to provide value to clients as a liaison between Accounting / Finance and Information Services. Moreover, as a Certified Information Technology Professional (CITP) - a Certified Public Accountant recognized for his or her unique ability to provide business insight by leveraging knowledge of information relationships and supporting technologies - Bill offers his clients the CPA's perspective and ability to understand the complicated business implications and risks associated with technology. From this perspective, he helps them to effectively manage information while ensuring the data's reliability, security, accessibility and relevance. Bill has implemented enterprise business intelligence systems over the years for many Fortune 500 companies, focusing his practice (since the advent of MSSQL Server 2000) upon the integrated Microsoft business intelligence solution. He leverages his years of experience with other enterprise OLAP and reporting applications (Cognos, Business Objects, Crystal, and others) in regular conversions of these once-dominant applications to the Microsoft BI stack. Bill believes it is easier to teach technical skills to people with non-technical training than vice-versa, and he constantly seeks ways to graft new technology into the Accounting and Finance arenas. Bill was awarded Microsoft SQL Server MVP in 2009. Hobbies include advanced literature studies and occasional lectures, with recent concentration upon the works of William Faulkner, Henry James, Marcel Proust, James Joyce, Honoré de Balzac, and Charles Dickens. Other long-time interests have included the exploration of generative music sourced from database architecture.