dbTalk Databases Forums  

LastPeriods

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


Discuss LastPeriods in the microsoft.public.sqlserver.olap forum.



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

Default LastPeriods - 11-17-2006 , 04:38 PM






Hello,

I am trying to retrieve the last 3 periods from the current month (ie Sept,
Oct, Nov). I am thinking that LastPeriods function might work, but I am
getting the following Error "The LASTPERIODS function expects a member
expression for the 0 argument. A tuple set expression was used." Here's the
code.

SELECT { LASTPERIODS (3, TAIL(nonempty([Week].[Week].[Week Name].Members)) )
} ON COLUMNS FROM [GMDSummary]


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

Default RE: LastPeriods - 11-18-2006 , 08:01 AM






Hi Lawrence,

Try this:

SELECT { LASTPERIODS (3, TAIL(nonempty([Week].[Week].[Week
Name].Members),1).Item(0) )
} ON COLUMNS FROM [GMDSummary]


The error message is telling you that the LastPeriods function takes a
member as an argument and you have specified a set. TAIL and HEAD functions
return sets, even if the set has only one member. You need to use the Item
function to take one member out of the set. In this case there is only one
member so you can use Item(0).

Hope this helps.

SHW

"Lawrence" wrote:

Quote:
Hello,

I am trying to retrieve the last 3 periods from the current month (ie Sept,
Oct, Nov). I am thinking that LastPeriods function might work, but I am
getting the following Error "The LASTPERIODS function expects a member
expression for the 0 argument. A tuple set expression was used." Here's the
code.

SELECT { LASTPERIODS (3, TAIL(nonempty([Week].[Week].[Week Name].Members)) )
} ON COLUMNS FROM [GMDSummary]


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.