Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

SSAS 2008 R2 MDX : how to get dynamic ranks in MDX query?

$
0
0

hi ,

i am new to SSAS MDX queries . i have to get ranks to the specific columns ex:CMO,SHO etc.

currently i am getting all ranks uniquly to the columns but actually ranks need to be  change.

i used the below query for this

WITH 
member [measures].[Sum Amount] as
 Sum([Measures].[Paid Amount])
     SET Grouporders AS
     order
     ([Fact Top Diagnosis].[Group].members
     ,[Measures].[Claim Count],bdesc
     )
     SET SMOrdered AS 
        Order 
        ( 
          [Fact Top Diagnosis].[Diagnosis Code].MEMBERS 
         ,[Measures].[Claim Count]
         ,BDESC 
        ) 
MEMBER [Measures].[SMO Rank] AS 
        Rank 
        ( 
         [Fact Top Diagnosis].[Diagnosis Code].currentmember
         ,SMOrdered
        ) 
     set CMOrders as
        order
        (
        [Fact Top Diagnosis].[Diagnosis Code].members
        ,[Measures].[Claim Count],bDESC
        )   
        MEMBER [Measures].[CMO Rank] AS
        Rank
        (
         [Fact Top Diagnosis].[Diagnosis Code].currentmember
        ,CMOrders
        )
     set PHOrders as
        order
        (
     [Fact Top Diagnosis].[Diagnosis Code].members
        ,[Measures].[Claim Count],bDESC
        )   
        MEMBER [Measures].[PH Rank] AS
        Rank
        (
        [Fact Top Diagnosis].[Diagnosis Code].currentmember
        ,PHOrders
        )
SELECT 
      { 
      [measures].[Sum Amount]
         ,[Measures].[SMO Rank]
        ,[Measures].[CMO Rank]
        ,[Measures].[PH Rank]
       
      } ON columns 
     ,([CMOrders],
     [Fact Top Diagnosis].[Diagnosis Description]
     ) ON rows 
    FROM [DM Financial] 

Note: The ranks should vary depeneding on columns, i hope i did a small mistakes in the MDX query.

if other than above columns (CMO,SHO) if i get coulmns with rank dynamically its very help full to me.

actually i need to use the above MDX in my SSRS Reports.

thanks in advance.


franklinsentil


Viewing all articles
Browse latest Browse all 14337


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>