dbTalk Databases Forums  

MTD for last 6 months

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss MTD for last 6 months in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Priya
 
Posts: n/a

Default MTD for last 6 months - 09-16-2003 , 05:05 PM






I need some help with MDX for defining a named set.
I need, as part of the time dimension, a set that includes
MTD for the current month
MTD for last month
MTD for 2 months prior
MTD for 3 months prior and so on till MTD for 6 months
prior
I.e when current date is Sep 15, the members in the set
need to be MTD (i.e. sum of sept 1-15), MTD for 1 month
prior i.e. sum of Aug 1-15, MTD for 2 months prior i.e.
sum of July 1-15 and so on till MTD 6 months prior i.e sum
of March 1-15.

What do I need to put in the definition of the named set?

Thanks in advance,
Priya

Reply With Quote
  #2  
Old   
Tom Chester
 
Posts: n/a

Default Re: MTD for last 6 months - 09-16-2003 , 06:44 PM






Is the 15th an example, or do you specifically want MTD through the 15th?
(There may be a better approach than the named sets.)

tom @ the domain below
www.tomchester.net


"Priya" <priyasund (AT) hotmail (DOT) com> wrote

Quote:
I need some help with MDX for defining a named set.
I need, as part of the time dimension, a set that includes
MTD for the current month
MTD for last month
MTD for 2 months prior
MTD for 3 months prior and so on till MTD for 6 months
prior
I.e when current date is Sep 15, the members in the set
need to be MTD (i.e. sum of sept 1-15), MTD for 1 month
prior i.e. sum of Aug 1-15, MTD for 2 months prior i.e.
sum of July 1-15 and so on till MTD 6 months prior i.e sum
of March 1-15.

What do I need to put in the definition of the named set?

Thanks in advance,
Priya



Reply With Quote
  #3  
Old   
Jim Kaiser
 
Posts: n/a

Default Re: MTD for last 6 months - 09-17-2003 , 10:41 AM



Try this for a named set::
With set [CurrentAndLastSixMTD] as
'Union(
periodstodate([Time].[Month],[Time].CurrentMember),
periodstodate([Time].[Month],parallelperiod([Time].[Month],1,[Time].currentm
ember)),
periodstodate([Time].[Month],parallelperiod([Time].[Month],2,[Time].currentm
ember)),
periodstodate([Time].[Month],parallelperiod([Time].[Month],3,[Time].currentm
ember)),
periodstodate([Time].[Month],parallelperiod([Time].[Month],4,[Time].currentm
ember)),
periodstodate([Time].[Month],parallelperiod([Time].[Month],5,[Time].currentm
ember)),
periodstodate([Time].[Month],parallelperiod([Time].[Month],6,[Time].currentm
ember)),
)'
Or you could do Sum(Union(...))as a calculated measure. Then, when you
select a day in the time dimension and this calculated measure, you'll see
the cumulative MTD for the current and six months back.

Jim

"Priya" <priyasund (AT) hotmail (DOT) com> wrote

Quote:
I need some help with MDX for defining a named set.
I need, as part of the time dimension, a set that includes
MTD for the current month
MTD for last month
MTD for 2 months prior
MTD for 3 months prior and so on till MTD for 6 months
prior
I.e when current date is Sep 15, the members in the set
need to be MTD (i.e. sum of sept 1-15), MTD for 1 month
prior i.e. sum of Aug 1-15, MTD for 2 months prior i.e.
sum of July 1-15 and so on till MTD 6 months prior i.e sum
of March 1-15.

What do I need to put in the definition of the named set?

Thanks in advance,
Priya



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.