Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how to get order month name in MDx Query Expand / Collapse
Author
Message
Posted Tuesday, December 2, 2008 9:28 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, November 16, 2011 10:48 AM
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,
........

.


Post #612151
Posted Tuesday, December 2, 2008 10:17 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, August 22, 2013 7:25 AM
Points: 347, Visits: 1,344
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
Post #612218
Posted Tuesday, December 2, 2008 5:02 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, December 10, 2013 10:06 PM
Points: 374, Visits: 428
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
Post #612479
Posted Wednesday, December 3, 2008 12:52 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, November 16, 2011 10:48 AM
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
Post #612606
Posted Wednesday, December 3, 2008 5:21 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, August 22, 2013 7:25 AM
Points: 347, Visits: 1,344
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
Post #612731
Posted Friday, March 13, 2009 3:59 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, October 19, 2009 12:09 PM
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]
Post #675663
Posted Friday, February 5, 2010 4:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 5, 2014 9:07 AM
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.
Post #860328
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse