posted 12/1/2009 8:47:53 AM by DevinKnight
Developing MDX calculations is one of the most confusing and time consuming pieces of building an Analysis Services cube. That is why I have accumulated what I like to call a Utility Belt of calculation that I can pull out at any moment to solve a problem. I consider this a Utility Belt because on just about every Analysis Services project that I have worked on these calculations have come in handy and I hope they will be helpful for you.
When building calculations you may find the templates that are available in Business Intelligence Development Studio (BIDS) as a helpful starting point. Unfortunately, I have found even using these templates can make calculations more confusing than they really need to be.
In this blog series I will give you the business problem, solution, and then calculation that satisfies the business problem.
Problem
You need to return sales for one year prior (Ex. one year ago, four quarters ago, twelve months ago).
Solution
Use the ParrallelPeriod time series function to look back a set number of values back in a date hierarchy and return the sales at that point.
Calculations
Looking back one year at the Year level
(ParallelPeriod([Date].[Date Hierarchy].[Year],1,[Date].[Date Hierarchy].CurrentMember),[Measures].[Sales Amount])
---------------------------------------------------------------
Looking back four quarters at the Quarter level
(ParallelPeriod([Invoice Date].[Date Hierarchy].[Quarter],4,[Invoice Date].[Date Hierarchy].CurrentMember),[Measures].[Sales Amount])
Looking back twelve months at the Month level
(ParallelPeriod([Invoice Date].[Date Hierarchy].[Month],12,[Invoice Date].[Date Hierarchy].CurrentMember),[Measures].[Sales Amount])
DevinKnight (Member since: 10/27/2009 11:25:07 AM) Devin (MCTS, MCITP) is a Senior BI consultant at Pragmatic Works Consulting. Previously, he has tech edited the book Professional Microsoft SQL Server 2008 Integration Services and was an author in the book Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services. Devin has spoken at past conferences like PASS and at several SQL Saturday events. He is a contributing member to the Business Intelligence Special Interest Group (SIG) for PASS as a leader in the SSIS Focus Group. Making his home in Jacksonville, FL, Devin helps run his local users’ group (JSSUG) as a Vice President.
View DevinKnight 's profile
Leave a comment
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address: