dbTalk Databases Forums  

MDX Help request - LastPeriods function

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


Discuss MDX Help request - LastPeriods function in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
wantnospam@email.com
 
Posts: n/a

Default MDX Help request - LastPeriods function - 02-28-2005 , 11:38 PM






Hi,

I need to calculate the average of one of my measure (called NetSales) for the last 3 months as per the following logic:

If my selected time period is Dec, then I want to get the average of the NetSales for Sep, Oct., and Nov.

I have tried using the LastPeriods function (as follows) but that returns the average of Oct., Nov., and Dec.

AVG(LastPeriods (3, [Time].CurrentMember), [Measures].[NetSales])

Any idea how I can get the desired result.

Many thanks in advance.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Reply With Quote
  #2  
Old   
Ohjoo Kwon
 
Posts: n/a

Default Re: MDX Help request - LastPeriods function - 02-28-2005 , 11:59 PM






AVG(LastPeriods (3, [Time].CurrentMember.PrevMember), [Measures].[NetSales])

Ohjoo Kwon


"Learner" <wantnospam (AT) email (DOT) com> wrote

Quote:
Hi,

I need to calculate the average of one of my measure (called NetSales) for
the last 3 months as per the following logic:

If my selected time period is Dec, then I want to get the average of the
NetSales for Sep, Oct., and Nov.

I have tried using the LastPeriods function (as follows) but that returns
the average of Oct., Nov., and Dec.

AVG(LastPeriods (3, [Time].CurrentMember), [Measures].[NetSales])

Any idea how I can get the desired result.

Many thanks in advance.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...




Reply With Quote
  #3  
Old   
wantnospam@email.com
 
Posts: n/a

Default Re: MDX Help request - LastPeriods function - 03-01-2005 , 12:57 AM



Hi Ohjoo,

Tons and millions (make it billions) of thanks. That does the trick

Can you plese guide me to some good resource from where I can also get a good hang of MDX.

Regards.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Reply With Quote
  #4  
Old   
Ohjoo Kwon
 
Posts: n/a

Default Re: MDX Help request - LastPeriods function - 03-01-2005 , 08:15 AM



I recommend the related books.

1. "Fast Track to MDX" by Mark Whitehorn, Mosha Pasumansky, Robert Zare
2. "MDX Solutions: With Microsoft SQL Server Analysis Services" by George
Spofford

Also, the home page of Mosha Pasumansky, the development lead for the
Microsoft Analysis Services engine.

http://www.mosha.com/msolap/


Ohjoo


"Learner" <wantnospam (AT) email (DOT) com> wrote

Quote:
Hi Ohjoo,

Tons and millions (make it billions) of thanks. That does the trick

Can you plese guide me to some good resource from where I can also get a
good hang of MDX.

Regards.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...




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.