Report Portal

MDX-Query to show the first day of the last date month in the cube

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)

Tags: mdx, faq

 

2007-2015 VidasSoft Systems Inc.