Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to get order month name in MDx Query


how to get order month name in MDx Query

Author
Message
Naginder Pathania
Naginder Pathania
SSC-Enthusiastic
SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)

Group: General Forum Members
Points: 164 Visits: 542
WITH MEMBER [Measures].[ParameterCaption] AS '[Order Date].[Month Name].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Order Date].[Month Name].CURRENTMEMBER.UNIQUENAME' MEMBER [Measures].[ParameterLevel] AS '[Order Date].[Month Name].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Order Date].[Month Name].ALLMEMBERS ON ROWS FROM ( SELECT ( STRTOSET(@OrderDateFiscalYear, CONSTRAINED) ) ON COLUMNS FROM [Tiger Ware House])


result given by above query is :

ParameterCaption ParameterValue ParameterLevel
All All [Order Date].[Month Name].[All] 0
April April [Order Date].[Month Name].&[April] 1
August August [Order Date].[Month Name].&[August] 1
December December [Order Date].[Month Name].&[December] 1
February February [Order Date].[Month Name].&[February] 1
January January [Order Date].[Month Name].&[January] 1
July July [Order Date].[Month Name].&[July] 1
June June [Order Date].[Month Name].&[June] 1
March March [Order Date].[Month Name].&[March] 1
May May [Order Date].[Month Name].&[May] 1
November November [Order Date].[Month Name].&[November] 1
October October [Order Date].[Month Name].&[October] 1
September September [Order Date].[Month Name].&[September] 1
Unknown (null) (null) (null)


required result :

January,
Febuary,
March,
April,
........

.
denglishbi
denglishbi
Old Hand
Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)

Group: General Forum Members
Points: 353 Visits: 1362
It appears that you need to take a look at the dimension design in the SSAS database. Are the key and name column properties for this attribute set to the same value - the month name description. Do you have any other attributes to sort by in the dimension table? You need to possibly switch the key column reference or setup another attribute with the properly sort value and relate it to this attribute and change the sort order by property to the new attribute key.

----------------------------------------------------------------------------------------
Dan English - http://denglishbi.wordpress.com
VALEK
VALEK
Old Hand
Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)Old Hand (388 reputation)

Group: General Forum Members
Points: 388 Visits: 462
Theres no way you can order something which has no sortable field (property) unless you hardcode the order.
You must have an attribute in your time (month) dimension which is sortable.
From the code you pasted you cannot see it.

In our cubes sorting is coded within the cubes using say, month ID, year, day etc. so that we do not have to sort it outside of the cubes.

M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM
Naginder Pathania
Naginder Pathania
SSC-Enthusiastic
SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)SSC-Enthusiastic (164 reputation)

Group: General Forum Members
Points: 164 Visits: 542
Hi , thanks for ur reply, i have another field month that can be used as in sort, but i need mdx code to use it . pls help me to sort sript to be used in above MDX query
denglishbi
denglishbi
Old Hand
Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)Old Hand (353 reputation)

Group: General Forum Members
Points: 353 Visits: 1362
So in the SSAS database in the date dimension is there a relationship between month name and month? Which is related to which? You could just set the month attributes name column property to month name and make sure that the OrderBy property is set to key and you should be all set. When referencing the month attribute it would be sorted as you would expect and it would display the proper text.

If you have the month related to month name then you could switch the OrderBy to AttributeKey and then set the OrderByAttribute property to month. Then the month name attribute would be sorted by the sort column.

----------------------------------------------------------------------------------------
Dan English - http://denglishbi.wordpress.com
dciceman
dciceman
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 12
Here is the MDX query to reorder your Month

WITH

Member [OrderMonth] as
CASE [Month].Currentmember.Member_Caption
When 'Jan' THEN 1
when 'Feb' THEN 2
WHEN 'Mar' THEN 3
WHEN 'Apr' THEN 4
WHEN 'May' THEN 5
WHEN 'Jun' THEN 6
WHEN 'Jul' THEN 7
WHEN 'Aug' THEN 8
WHEN 'Sep' THEN 9
WHEN 'Oct' THEN 10
WHEN 'Nov' THEN 11
WHEN 'Dec' THEN 12
ELSE 'No Month'
END

SELECT
{(ORDER(([Month].ALLMEMBERS), [OrderMonth], ASC))} ON COLUMNS,
{[Row Data]} ON ROWS

FROM [DB Name]
dtrainer
dtrainer
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 169
I had the same problem and this worked for me, (setting Month attribute name to the month name, and then ordering on the month key). thanks.
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