dbTalk Databases Forums  

PeriodsToDate() MSDN Documentation Wrong?

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


Discuss PeriodsToDate() MSDN Documentation Wrong? in the microsoft.public.sqlserver.olap forum.



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

Default PeriodsToDate() MSDN Documentation Wrong? - 07-20-2006 , 01:42 AM






I'm having trouble understanding how the periodstodate() function works in
MSAS2K5

using the example query from:
http://msdn2.microsoft.com/en-us/library/ms144925.aspx

WITH MEMBER [Date].[Calendar].[First9Months2003] AS
'Aggregate(
PeriodsToDate(
[Date].[Calendar].[Month],
[Date].[Calendar].[Month].[September 2003]
)
)'
SELECT
[Date].[Calendar].[First9Months2003] ON COLUMNS,
[Product].[Category].Children ON ROWS
FROM
[Adventure Works]
WHERE
[Measures].[Order Quantity]

I get the following results:
4,771
4,344
5,179
4,365

for a total of 18,659

which appears to be the total for just September 2003

not the first nine months of 2003 which is 82,410

is there an error in the documentation or are my numbers incorrect?

Thanks

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: PeriodsToDate() MSDN Documentation Wrong? - 07-21-2006 , 01:34 AM






There seems to be a typo in the sample query - it should be:

Quote:
WITH MEMBER [Date].[Calendar].[First9Months2003] AS
'Aggregate(
PeriodsToDate(
[Date].[Calendar].[Calendar Year],
[Date].[Calendar].[Month].[September 2003]
)
)'
SELECT
[Date].[Calendar].[First9Months2003] ON COLUMNS,
[Product].[Category].Children ON ROWS
FROM
[Adventure Works]
WHERE
[Measures].[Order Quantity]
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
BigJimSlade
 
Posts: n/a

Default Re: PeriodsToDate() MSDN Documentation Wrong? - 07-21-2006 , 10:51 AM



Thanks, Deepak I thought I was losing my mind.

"Deepak Puri" wrote:

Quote:
There seems to be a typo in the sample query - it should be:


WITH MEMBER [Date].[Calendar].[First9Months2003] AS
'Aggregate(
PeriodsToDate(
[Date].[Calendar].[Calendar Year],
[Date].[Calendar].[Month].[September 2003]
)
)'
SELECT
[Date].[Calendar].[First9Months2003] ON COLUMNS,
[Product].[Category].Children ON ROWS
FROM
[Adventure Works]
WHERE
[Measures].[Order Quantity]



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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.