dbTalk Databases Forums  

problem sorting by members

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


Discuss problem sorting by members in the microsoft.public.sqlserver.olap forum.



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

Default problem sorting by members - 07-12-2006 , 01:51 PM






This query


SELECT
[Measures].[Reseller Sales Amount] ON COLUMNS,
Order (
Descendants (
[Employee].[Employee Department].[Department Name].&[Sales],
[Employee].[Employee Department].[Title],
SELF),
ASC
) ON ROWS
FROM [Channel Sales]

fails with error
Query (8, 3) An expression was expected for the function argument and no
expression was detected.

And this query

SELECT
{
[Measures].[Reseller Sales Amount]
}
ON COLUMNS,

NON EMPTY
{
Order (
{Descendants ([Employee].[Employee Department].[Department Name].&[Sales],
[Employee].[Employee Department].[Title],SELF)},
[Employee].[Employee Department].CurrentMember,
ASC
)
}
ON ROWS
FROM [Channel Sales]

works but doesn't sort by [Employee].[Employee Department].CurrentMember

I'm obviously not getting the semantics of sorting by dimensions




--------------------
Chris Harrington
Active Interface, Inc.
http://www.activeinterface.com



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

Default Re: problem sorting by members - 07-12-2006 , 07:14 PM






Hi Chris,

The 2nd argument of Order() is a numeric or string expression by which
to order the members of the 1st argument. So I assume that you wanted
something like:

Quote:
SELECT
[Measures].[Reseller Sales Amount] ON COLUMNS,
Order (
Descendants (
[Employee].[Employee Department].[Department Name].&[Sales],
[Employee].[Employee Department].[Title],
SELF),
[Measures].[Reseller Sales Amount],
ASC
) ON ROWS
FROM [Channel Sales]
---------------------------------------------------------
Reseller Sales Amount
Vice President of Sales (null)
Pacific Sales Manager $172,524.45
European Sales Manager $732,078.44
North American Sales Manager $1,092,123.86
Sales Representative $78,453,870.23
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: problem sorting by members - 07-13-2006 , 12:02 AM



Deepak,

No, actually what I want is to sort by the Title string. And get results as:


European Sales Manager $732,078.44
North American Sales Manager $1,092,123.86
Pacific Sales Manager $172,524.45
Sales Representative $78,453,870.23
Vice President of Sales (null)

Chris


"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
Hi Chris,

The 2nd argument of Order() is a numeric or string expression by which
to order the members of the 1st argument. So I assume that you wanted
something like:


SELECT
[Measures].[Reseller Sales Amount] ON COLUMNS,
Order (
Descendants (
[Employee].[Employee Department].[Department Name].&[Sales],
[Employee].[Employee Department].[Title],
SELF),
[Measures].[Reseller Sales Amount],
ASC
) ON ROWS
FROM [Channel Sales]
---------------------------------------------------------
Reseller Sales Amount
Vice President of Sales (null)
Pacific Sales Manager $172,524.45
European Sales Manager $732,078.44
North American Sales Manager $1,092,123.86
Sales Representative $78,453,870.23



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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



Reply With Quote
  #4  
Old   
ChrisHarrington
 
Posts: n/a

Default Re: problem sorting by members - 07-13-2006 , 12:08 AM



I think I figured out my issue. I changed
[Employee].[Employee Department].CurrentMember

to

[Employee].[Employee Department].CurrentMember.Name

and now it sorts by employee title

"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
Hi Chris,

The 2nd argument of Order() is a numeric or string expression by which
to order the members of the 1st argument. So I assume that you wanted
something like:


SELECT
[Measures].[Reseller Sales Amount] ON COLUMNS,
Order (
Descendants (
[Employee].[Employee Department].[Department Name].&[Sales],
[Employee].[Employee Department].[Title],
SELF),
[Measures].[Reseller Sales Amount],
ASC
) ON ROWS
FROM [Channel Sales]
---------------------------------------------------------
Reseller Sales Amount
Vice President of Sales (null)
Pacific Sales Manager $172,524.45
European Sales Manager $732,078.44
North American Sales Manager $1,092,123.86
Sales Representative $78,453,870.23



- 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.