Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Analysis Services (2000)
 Age group sorting?

Author  Topic 

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2004-08-09 : 11:33:28
Hi guys,
I'm new to MDX and so it may be a very basic question.
Anyway, here we go.
I get a dimension which is age group. it contains two levels:
age group e.g. 18~25, 26~30, 30~35, >35
age e.g. 18, 19, 20, 21, 22 ...
And i get another dimension which is measures with a user_count
Finally, another dimension like. gender

I write a simple dmx and it returns the user_count along with the age group and age and gender with the crossjoin function
However, it sorting in a strange order and I don't know how to control it.
I read some article about the order function but can't make it work.
Any tips on this?
Any help is very much appreicated. thx

mfemenel
Professor Frink

1421 Posts

Posted - 2004-08-09 : 12:23:35
Try using a case statement in your order by. Since your groups are 18-25, it's not using numeric values.
You'd need to do something like

order by case age_group when '18-25' then 1,
when '26-30' then 2 etc etc.




Mike
"oh, that monkey is going to pay"
Go to Top of Page

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2004-08-09 : 20:37:11
Hi mfemenel,
thx for your reply. however, i don't fully understand what u mean.
my original statement is sth like:

select {[Measures].[user count]} ON COLUMNS, NonEmptycrossjoin ([AuthList].[name].members, [AgeGroup].[age].members) ON ROWS FROM [UserBackground]

How can I add the order by statement on top of this?
Is it a basic sql statement rather than mdl?

Go to Top of Page
   

- Advertisement -