How would you order MDX query -


i unable figure out how simple "order by" clause.

below query - how order service name adjusted incidents?

select    {[measures].[adjusted incidents]} on columns  ,non empty      {         [completed inspections].[service name].[service name].allmembers       *          [inspected items].[item name].[item name].allmembers     }   dimension properties member_caption  on rows  (   select      {       [completed inspections].[customer id].&[drhod]      ,[completed inspections].[customer id].&[emhst]      ,[completed inspections].[customer id].&[exhou]      ,[completed inspections].[customer id].&[etrad]     } on columns   [inspections] )    (     [calendar].[month].&[2015-05-01t00:00:00]    ,[completed inspections].[is reinspection].&[false]   ) cell properties value; 

there isn't clause order in mdx similar sql.

you need apply function order sets wish order. here msdn definition:
https://msdn.microsoft.com/en-us/library/ms145587.aspx

nesting orders isn't trivial in mdx - inside application of order order want applied second outside nest order want applied first:

select    {[measures].[adjusted incidents]} on columns  ,non empty      order     (       order       (         {             [completed inspections].[service name].[service name].allmembers           *              [inspected items].[item name].[item name].allmembers         }        ,[measures].[adjusted incidents]        ,bdesc  //<<you have 4 choices here bdesc, basc, desc, or asc       )      ,[completed inspections].[service name].currentmember.member_caption      ,bdesc    //<<you have 4 choices here bdesc, basc, desc, or asc     )   dimension properties member_caption  on rows  (   select      {       [completed inspections].[customer id].&[drhod]      ,[completed inspections].[customer id].&[emhst]      ,[completed inspections].[customer id].&[exhou]      ,[completed inspections].[customer id].&[etrad]     } on columns   [inspections] )    (     [calendar].[month].&[2015-05-01t00:00:00]    ,[completed inspections].[is reinspection].&[false]   ) cell properties value; 

Comments