Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDX Query Leap year problem

Status
Not open for further replies.

burakcan

Programmer
Oct 10, 2011
39
CA
Hello
I have a MDX query which uses by one of our reports.
The query calculates current year and previous year YTD values.
the [YTD Prev Year Unique Product Submissions] based on the Fiscal Day.
The problem is previous year calculation of the Feb 29. Because there is no Feb 29 previous year. (Please see the attachment)

any help will be appreciated.

Here is the query

WITH SET [TimeSet1] AS
GENERATE(
{
PARALLELPERIOD([Time].[Y-Q-M-D Fiscal].[Fiscal Month], 14, STRTOMEMBER("[Time].[Y-Q-M-D Fiscal].[Fiscal Month].&[2016]&[4]"))
:
PARALLELPERIOD([Time].[Y-Q-M-D Fiscal].[Fiscal Month], 1, STRTOMEMBER("[Time].[Y-Q-M-D Fiscal].[Fiscal Month].&[2016]&[4]"))
}
, {[Time].[Y-Q-M-D Fiscal].LastChild}
)



SET [TimeSet2] AS
UNION (
[TimeSet1],
STRTOMEMBER("[Time].[Y-Q-M-D Fiscal].[Fiscal Month].&[2016]&[4]").LASTCHILD
)

MEMBER [MonthName] AS [Time].[Y-Q-M-D Fiscal].CurrentMember.Parent.Properties ("MEMBER_NAME")

SELECT
{
[MonthName],
[Measures].[YTD Unique Product Submissions],
[Measures].[YTD Prev Year Unique Product Submissions],
[Measures].[YoY Unique Product Submissions]
} ON COLUMNS,
{
STRTOSET("[Product Hierarchy].[Product Line].&[PRS]",CONSTRAINED) * [TimeSet2]
} ON ROWS
FROM [MY_Cube]
 
 http://files.engineering.com/getfile.aspx?folder=232d3640-a394-48c0-96bd-3f2f0446c8a0&file=Leap_year_Issue.png
HI,

How about YTD < [first of the next month]

...rather than [last of the month]

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top