dbTalk Databases Forums  

Order() by diension position with lastperiods()

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


Discuss Order() by diension position with lastperiods() in the microsoft.public.sqlserver.olap forum.



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

Default Order() by diension position with lastperiods() - 03-12-2005 , 11:35 AM






i have a time dimension with years, quarters, and months

in a report I need to show the last 2 months, then the last 2 quarters, then
the last 2 years, each in descending order.

I use this query to pull them

{LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild),LastPeriods(2,[FiscalDate].LastChild.LastChild),LastPeriods(2,[FiscalDate].LastChild)}


my new year starts in march, so right now this query returns (in this order):

feb 2005, march 2006, quarter 4 2005, quarter 1 2006, 2005, 2006

i need the query to return each "subset" in descending order, so my results
look like this

march 2006, feb 2005, quarter 1 2006, quarter 4 2005, 2006, 2005

I've tried different arguments to the order function but have been
unsucessful so far.

thanks!

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

Default Re: Order() by diension position with lastperiods() - 03-12-2005 , 09:12 PM






{
Order(LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
, Order(LastPeriods(2,[FiscalDate].LastChild.LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
, Order(LastPeriods(2,[FiscalDate].LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
}

or

Order({LastPeriods(2,[FiscalDate].LastChild),
LastPeriods(2,[FiscalDate].LastChild.LastChild),
LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild)} AS SetA,
Rank([FiscalDate].CurrentMember, SetA),
BDESC
)

Ohjoo Kwon


"Paul" <Paul (AT) discussions (DOT) microsoft.com> wrote

Quote:
i have a time dimension with years, quarters, and months

in a report I need to show the last 2 months, then the last 2 quarters,
then
the last 2 years, each in descending order.

I use this query to pull them


{LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild),LastPeriods(2,[Fi
scalDate].LastChild.LastChild),LastPeriods(2,[FiscalDate].LastChild)}
Quote:

my new year starts in march, so right now this query returns (in this
order):

feb 2005, march 2006, quarter 4 2005, quarter 1 2006, 2005, 2006

i need the query to return each "subset" in descending order, so my
results
look like this

march 2006, feb 2005, quarter 1 2006, quarter 4 2005, 2006, 2005

I've tried different arguments to the order function but have been
unsucessful so far.

thanks!



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

Default Re: Order() by diension position with lastperiods() - 03-12-2005 , 09:45 PM



thank you , that worked great!

"Ohjoo Kwon" wrote:

Quote:
{
Order(LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
, Order(LastPeriods(2,[FiscalDate].LastChild.LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
, Order(LastPeriods(2,[FiscalDate].LastChild),
[FiscalDate].CurrentMember.Properties("ID"), BDESC)
}

or

Order({LastPeriods(2,[FiscalDate].LastChild),
LastPeriods(2,[FiscalDate].LastChild.LastChild),
LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild)} AS SetA,
Rank([FiscalDate].CurrentMember, SetA),
BDESC
)

Ohjoo Kwon


"Paul" <Paul (AT) discussions (DOT) microsoft.com> wrote in message
news:1DE60272-AF24-4AD7-9B80-1E8B8A331952 (AT) microsoft (DOT) com...
i have a time dimension with years, quarters, and months

in a report I need to show the last 2 months, then the last 2 quarters,
then
the last 2 years, each in descending order.

I use this query to pull them


{LastPeriods(2,[FiscalDate].LastChild.LastChild.LastChild),LastPeriods(2,[Fi
scalDate].LastChild.LastChild),LastPeriods(2,[FiscalDate].LastChild)}


my new year starts in march, so right now this query returns (in this
order):

feb 2005, march 2006, quarter 4 2005, quarter 1 2006, 2005, 2006

i need the query to return each "subset" in descending order, so my
results
look like this

march 2006, feb 2005, quarter 1 2006, quarter 4 2005, 2006, 2005

I've tried different arguments to the order function but have been
unsucessful so far.

thanks!




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.