SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stairway to MDX - STEP 3: The Order() Function


Stairway to MDX - STEP 3: The Order() Function

Author
Message
Bill_Pearson
Bill_Pearson
SSC-Addicted
SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)SSC-Addicted (443 reputation)

Group: General Forum Members
Points: 443 Visits: 85
Comments posted to this topic are about the item Stairway to MDX - STEP 3: The Order() Function
Roland Brown
Roland Brown
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 56
Item 3 code mismatch:

{[Geography].[Geography].[State-Province].[Alabama].CHILDREN,
[Geography].[Geography].[State-Province].[Alabama].CHILDREN}

s/b Alabama, Mississippi
jeff122877
jeff122877
SSC-Enthusiastic
SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)SSC-Enthusiastic (197 reputation)

Group: General Forum Members
Points: 197 Visits: 204
I'm going to leave this right here, even though I think it might just get answered in the next Stairway article.


In the example from STEP 3, how could I sort by Resellers Sales Amount DESC without the State_Province natural heirarchy breaking it up into what to me is two separate sorGed lists. I want to see Resellers Sales Amount in DESC order with out grouping by state.

Great article so far. It's giving me the kick start to MDX that I needed (I wanted to learn MDX but didn't know where to start).

EDIT: Just as I thought. BASC and BDESC will do this and are explained in the next Step

Jeff.
rgtft
rgtft
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1805 Visits: 754
I get this error for the below code:
Query (11, 7) Parser: The syntax for 'ORDER' is incorrect.


-- SMDX003-004 Simple Use of Order() function across columns,
-- sort descending(respecting hierarchies)


SELECT

NONEMPTY

ORDER(

{[Geography].[Geography].[State-Province].[Alabama].CHILDREN,

[Geography].[Geography].[State-Province].[Mississippi].CHILDREN},

[Measures].[Reseller Sales Amount], DESC

) ON AXIS(0),

{[Measures].[Reseller Sales Amount]} ON AXIS(1)

FROM

[Adventure Works]



What's wrong with the syntax?

TIA,
Rob



sudeep.puvadi
sudeep.puvadi
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 51
hi all,

I just read the blog and still confused about the functionality of this order function.

According to the blog, when we add DESC keyword to the ORDER function, the data has to be sorted by fact value without any break in the natural hierarchy of dimensions, but why even the Alabama and Mississippi children are sorted ( I mean swapped).

I was expecting first the children of Alabama sorted by fact value DESC and then children of Mississippi sorted by fact value DESC.

Please help me in understanding this.

Thanks in Advance.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search