SSAS FAQ MDX FAQ MDX-Query to show the first day of the last date month in the cube
MDX-Query to show the first day of the last date month in the cube
User Rating: / 0
PoorBest 
Written by Vidas Matelis   
Thursday, 29 March 2007 18:52

Q: I Need an MDX statement to show the first day of the last month in the cube

A: First you could use the ClosingPeriod function at the month level to get the last month, and then use OpeningPeriod function to get first day of that month. Code example:

SELECT OpeningPeriod([Date].[Calendar].[Date]
, ClosingPeriod([Date].[Calendar].[Month], [Date].[Calendar].DefaultMember)
) ON 0
FROM [Sales Summary]

Result:

August 1, 2004
(null)

 
Strategy Companion