Report Portal

MDX-Query to get latest months and previous years same months data

Q: Need MDX Query to get latest months and previous years same months data

A: You can use ClosingPeriod function to get last month member and then use ParallelPeriod function to get previous years same month

SELECT {ClosingPeriod([Date].[Calendar].[Month], [Date].[Calendar].DefaultMember)
, ParallelPeriod([Date].[Calendar].[Calendar Year]
, 1
, ClosingPeriod([Date].[Calendar].[Month], [Date].[Calendar].DefaultMember)
)
} ON 0
FROM [Sales Summary]

Result:

August 2004 August 2003
(null) $5,060,385.02

Tags: mdx, faq

 

2007-2015 VidasSoft Systems Inc.