Hello All, I'm looking for some help with getting a KPI Trend expression to return the correct results.I have created a Calculated Member to return the qualifying Sales for the 6 months prior to the current period:[code="plain"]WITH MEMBER [Sales Previous 6 Months] ASSUM( { PARALLELPERIOD( [Business Written Date].[Dates by Month].[Calendar Year Quarter],2,[Business Written Date].[Dates by Month].CurrentMember): [Business Written Date].[Dates by Month].currentMember.prevMember } , ([Fact Sales].[PP Permission Active].&[Yes],[Measures].[Fact Sales Count])) [/code]When I use the Calculated Member in a KPI Trend expression, I get the correct results if I specify a single instance of a date or date period, e.g. 2013Q1 or 201006, but if I specify a range, e.g. 2012Q1 - 2012Q2, then the Trend is not correct.What I want is for any date range selected by a user browsing the Cube, if the total qualifying sales (i.e. those where [Fact Sales].[PP Permission Active] = 'Yes) are greater than the total qualifying sales for the 6 months prior to the date range selected, the Trend will be upwards and vice-versa. For example: User selects the date range 2012Q3 to 2012Q4 Let's say the total qualifying sales for that period is 10 The KPI Trend expression should use the [Sales Previous 6 Months] measure to return the total qualifying sales for the period 2012Q1 to 2012Q2 and check whether that figure is greater than, less than or equal to, 10 This is my Trend expression:[code="plain"]Case When IsEmpty(KPIGoal("Low PP")) Then Null// If there is no qualifying data for the previous period, the Trend should be positive provided that the KPIValue is greater than zero. When ISEMPTY([Measures].[Sales Previous 6 Months]) = TRUE AND KPIValue("Low PP") > 0 Then 1 When [Measures].[Sales Previous 6 Months] < KPIValue("Low PP") Then 1 When [Measures].[Sales Previous 6 Months] = KPIValue("Low PP") Then 0 Else -1End[/code]I suspect that the problem is that CurrentMember is being set to the last member in the date range - 2012Q4 in the above example - and therefore the [Sales Previous 6 Months] member is going back 2 quarters from there which is 2012Q2 whereas I want it to take the first member in the date range - 2012Q3 - and go back 2 quarters to 2012Q1.It must be a fairly common requirement to do this type of rolling date calculation, but the solution eludes me. Can anyone help?ThanksLempster
↧