December 2, 2008 at 9:28 am
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 :
ParameterCaptionParameterValueParameterLevel
AllAll[Order Date].[Month Name].[All]0
AprilApril[Order Date].[Month Name].&[April]1
AugustAugust[Order Date].[Month Name].&[August]1
DecemberDecember[Order Date].[Month Name].&[December]1
FebruaryFebruary[Order Date].[Month Name].&[February]1
JanuaryJanuary[Order Date].[Month Name].&[January]1
JulyJuly[Order Date].[Month Name].&[July]1
JuneJune[Order Date].[Month Name].&[June]1
MarchMarch[Order Date].[Month Name].&[March]1
MayMay[Order Date].[Month Name].&[May]1
NovemberNovember[Order Date].[Month Name].&[November]1
OctoberOctober[Order Date].[Month Name].&[October]1
SeptemberSeptember[Order Date].[Month Name].&[September]1
Unknown(null)(null)(null)
required result :
January,
Febuary,
March,
April,
........
.
December 2, 2008 at 10:17 am
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
December 2, 2008 at 5:02 pm
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
December 3, 2008 at 12:52 am
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
December 3, 2008 at 5:21 am
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
March 13, 2009 at 3:59 pm
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]
February 5, 2010 at 4:32 am
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.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply