SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


MDX - Cube Calculated member sliding 12 month comparison with previous month data


MDX - Cube Calculated member sliding 12 month comparison with previous month data

Author
Message
iBar
iBar
SSC Eights!
SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)

Group: General Forum Members
Points: 816 Visits: 842
Hi,

I want to compare Aggregate of following two different resultsets:



SELECT
[Measures].[Internet Sales Amount] ON COLUMNS,
NON Empty

{
LastPeriods(
12, [Date].[Calendar].[Month].[January 2008]
)
}
On Rows
FROM
[Adventure Works];
GO



SELECT
[Measures].[Internet Sales Amount] ON COLUMNS,
NON Empty

{
LastPeriods(
12, [Date].[Calendar].[Month].[February 2008]
)
}
On Rows
FROM
[Adventure Works];
GO






Now actually i want to add a calculated member in the cube in a way that in Current Month, it compares aggregated sales of previous 12 months with the aggregate of previous 12 month from one month before previous month.

For example

In march 2008
Aggregate(Mar2007 .... Feb2008) ,
Aggregate(Feb2007 .... Jan2008) ,
Aggregate(Mar2007 .... Feb2008) - Aggregate(Feb2007 .... Jan2008) AS Rolling_12Month_Growth.

Note: it is different from Month-Over-Month Growth.

So any clue please?

Thanks.
iBar
iBar
SSC Eights!
SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)

Group: General Forum Members
Points: 816 Visits: 842
Hi Moderator,

This is my second MDX question in "Analysis Services" forum of SSC and NO answer at all.

Am i on the right place for such questions? or what else?


Thanks.
iBar
iBar
SSC Eights!
SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)SSC Eights! (816 reputation)

Group: General Forum Members
Points: 816 Visits: 842
The best help i found on this question is available on following Link. Thanks to Pavel Pawlowski. Excellent work.

http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/1d00b9fd-80f9-493c-8d04-b125882a6e5c/#1d00b9fd-80f9-493c-8d04-b125882a6e5c

Thanks and Cheers.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62562 Visits: 19109
This is the right place, but we don't have a lot of MDX posters, so there might not be anyone that can easily answer.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
happycat59
happycat59
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4742 Visits: 3218
I think that the following will give you what you are after

WITH MEMBER Measures.CurrentMonth AS 'SUM ( [Date].[Calendar].Currentmember.lag(11) : [Date].[Calendar].Currentmember, [Measures].[Internet Sales Amount])'
MEMBER Measures.PriorMonth AS 'SUM ( [Date].[Calendar].Currentmember.lag(12) : [Date].[Calendar].Currentmember.lag(1), [Measures].[Internet Sales Amount])'
Member Measures.Difference AS 'Measures.CurrentMonth - Measures.PriorMonth'
SELECT
{measures.currentmonth, measures.priormonth, Measures.Difference} ON COLUMNS

FROM
[Adventure Works]
where ([Date].[Calendar].[Month].[February 2004])



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search