dbTalk Databases Forums  

last 12 month

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


Discuss last 12 month in the microsoft.public.sqlserver.olap forum.



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

Default last 12 month - 04-08-2004 , 11:54 AM






Hello every one ,

i would like to have a query where the YTD is replace by the last 12 month.

WITH MEMBER [TIME].[1998 YTD] AS 'SUM(YTD(ClosingPeriod(Month,
[Time].[1998])))'
MEMBER [TIME].[1997 YTD] AS
'SUM(YTD(ParallelPeriod(Year,1,ClosingPeriod(Month , [Time].[1998]))))'

SELECT {[TIME].[1998 YTD],[TIME].[1997 YTD]} ON ROWS, Measures.members on
columns from sales

I was thinking about periodtodate but it's not what I need


Thanks

Best Regards,

Patrice



Reply With Quote
  #2  
Old   
Prasanna
 
Posts: n/a

Default Re: last 12 month - 04-09-2004 , 03:45 AM






Simply use
(iif([Time].CurrentMember.Level.Ordinal=[Time].[Month].Ordinal,Avg(LastPeriods(12,Time.currentMember),Co alesceempty(([Measures].[Sales]),0)),Null))


will give you last12month's sales average


"Patrice Lamarche" <Patrice_lamarche (AT) gco (DOT) ca.nospam> wrote

Quote:
Hello every one ,

i would like to have a query where the YTD is replace by the last 12 month.

WITH MEMBER [TIME].[1998 YTD] AS 'SUM(YTD(ClosingPeriod(Month,
[Time].[1998])))'
MEMBER [TIME].[1997 YTD] AS
'SUM(YTD(ParallelPeriod(Year,1,ClosingPeriod(Month , [Time].[1998]))))'

SELECT {[TIME].[1998 YTD],[TIME].[1997 YTD]} ON ROWS, Measures.members on
columns from sales

I was thinking about periodtodate but it's not what I need


Thanks

Best Regards,

Patrice

Reply With Quote
  #3  
Old   
Patrice Lamarche
 
Posts: n/a

Default Re: last 12 month - 04-12-2004 , 06:52 AM



Thanks alot... it was lastperiod i was searching


Best Regards,

Patrice
"Prasanna" <tawargerip (AT) hotmail (DOT) com> wrote

Quote:
Simply use

(iif([Time].CurrentMember.Level.Ordinal=[Time].[Month].Ordinal,Avg(LastPerio
ds(12,Time.currentMember),Coalesceempty(([Measures].[Sales]),0)),Null))
Quote:

will give you last12month's sales average


"Patrice Lamarche" <Patrice_lamarche (AT) gco (DOT) ca.nospam> wrote

Hello every one ,

i would like to have a query where the YTD is replace by the last 12
month.

WITH MEMBER [TIME].[1998 YTD] AS 'SUM(YTD(ClosingPeriod(Month,
[Time].[1998])))'
MEMBER [TIME].[1997 YTD] AS
'SUM(YTD(ParallelPeriod(Year,1,ClosingPeriod(Month , [Time].[1998]))))'

SELECT {[TIME].[1998 YTD],[TIME].[1997 YTD]} ON ROWS, Measures.members
on
columns from sales

I was thinking about periodtodate but it's not what I need


Thanks

Best Regards,

Patrice



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.