Page 1 of 1

MDX Order to Sort

Posted: Wed Dec 11, 2019 5:36 pm
by kenship
Hi, I'm reading and testing to use MDX Order function to sort dimension element based on cube value. I think I got 80-90% but Expression Window in Subset Editor still gives me syntax error. Here's information:

Cube Name: Cube
Dimensions: DimA t0 DimE (with "$" being the measure in "DimE")
Dimension to be sorted : DimC

Here's my MDX code:

Code: Select all

{
ORDER(
            {TM1FILTERBYLEVEL(
                                               {TM1SUBSETALL( [ Cube ] )}
                                         ,0)
             }
           ,[Cube].(
                          [DimA].[(All Dim A)]
                         ,[DimB].[(All Dim B)]
                         ,[DimD].[(All Dim D)]
                         ,[DimE].[$]
                        )
                         ,[DimC] BDESC

        )
}
Thanks!
Kenneth

Re: MDX Order to Sort

Posted: Wed Dec 11, 2019 7:15 pm
by Wim Gielis
To name just 1 thing, I would expect to see TM1SubsetAll of DimC not of Cube.

Re: MDX Order to Sort

Posted: Wed Dec 11, 2019 7:28 pm
by kenship
Wim Gielis wrote: Wed Dec 11, 2019 7:15 pm To name just 1 thing, I would expect to see TM1SubsetAll of DimC not of Cube.
Ouch! You're right Wim.

I figured it out.

Here's what works for me:

Code: Select all

{
ORDER	(
		{ TM1FILTERBYLEVEL	(
						{TM1SUBSETALL(DimC)}
						,0
						)
		}
		,[Cube].(
				[DimA].[(ALL Dim A)]
				, [DimB].[(All Dim B)]
				, [DimD].[(All Dim D)]
				, [DimE].[$]
				), BDESC
		)
}