Solved

MDX  - 12 trailing months

Posted on 2014-02-06
1
488 Views
Last Modified: 2014-02-06
I need an MDX WHERE clause that will give me the selected date and the 11 preceding.  For example, select January 2014 and get Feb 2013 - Jan 2014.

Is there a DateDiff or something that I can use in the WHERE clause in MDX for this kind of query?

I have found LastPeriods:
WHERE (LastPeriods(12.0, [Dim Date.MonthNum].[11]))

But ... nothing there specifies the year.

Thanks!
0
Comment
Question by:Daniel Wilson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 0 total points
ID: 39839763
OK, I think I have it:

WHERE (LastPeriods(366.0, [Dim Date.FullDate].[2013-11-30])

This seems to go back 366 days ... spanning the 12 months I want.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question