I'm using a calculated member for "previous period" as:
Case
// Test for current coordinate being on (All) member.
When [<<Target Dimension>>].[<<Target Hierarchy>>].CurrentMember.Level Is
[<<Target Dimension>>].[<<Target Hierarchy>>].[(All)]
Then "NA"
Else (
ParallelPeriod
(
[<<Target Dimension>>].[<<Target Hierarchy>>].[<<Target Level>>],
<<Number of Periods>>,
[<<Target Dimension>>].[<<Target Hierarchy>>].CurrentMember
),
[Measures].[<<Target Measure>>]
)
End
// This expression evaluates the difference between the value of the numeric
// expression in the previous period and that of the current period.
(snippet code taken directly from Microsoft suggestion)
It works as expected but when presenting the Totals I get the whole Year total, even if only some months are selected on rows.
So, if I select say year 2015, months Jan to Jun, I get the six correct values for 2014 months but a 2014 grand total instead of the sum of the six presented values.
Any way to get the "correct" sum value? By correct I mean the sum of the selected rows.
Edited to add the actual code:
Case
When [Dim Time].[Calendar].CurrentMember.Level Is [Dim Time].[Calendar].[(All)]
Then "NA"
Else (ParallelPeriod([Dim Time].[Calendar].[Year],
1,
[Dim Time].[Calendar].CurrentMember),[Measures].[Sales])
End
My Dim Time.Calendar has Year-Month-Day as levels. Easy enough :)
When selecting some months the Year total is the Grand total of the year, not the total of the selected months. When selecting some days, the Month total is the Grand total of the month, not the total of the selected days.
Edited to add example:
Year Month Day Sales previous year Sales
2015 04 03 74,154.56 € 135,156.41 €
Total 04 2,617,045.75 € 135,156.41 €
Total 2015 37,696,665.69 € 135,156.41 €
mdx
questions? Such as this one: stackoverflow.com/questions/31000705/… – whytheq