MDX Procedure Based on .NET

MDX script in SSAS provides strong functions for multidimensional data analysis, however many problems are hard to solve with MDX actually. Because not all the problems can be cope with MDX script. In other words, these problems will be solved by coding way easily. MDX procedure is supported by all the .NET languages.

namespace  CustomAnalysisAssembly 

    
public   class  SPDemo 
    { 
        
public   static   double  SalesDifference( double  firstVal,  double  secondVal) 
        {
            
return  secondVal – firstVal; 
        } 
    }
}

 


The .NET MDX procedure can be used when a assembly that contain the specific procedure is deployed into the analysis server or multidimensional dataset. It is a demo .NET MDX procedure implemented by C#. Its function is to compute the subtraction of two numbers. The method is static. However it is not the only choice. Non-static method also can be used. But the server will create the same object for many times for using instance method. Obviously, it leads to the waste of system resources. In contrast, server will invoke the static method directly instead of creating instance object time and time again. So it is recommended to carry out the procedure by static method.

SELECT  MEMBER  [ Date ] . [ Diff ]   AS  
CustomAnalysisAssembly.SPDemo.SalesDifference(   
// Invoke .NET Method
    
[ Date ] . [ YMD ] . [ Year ] . & [ 2009 ]
    
[ Date ] . [ YMD ] . [ Year ] . & [ 2008 ]  

SELECT   [ Date ] . [ Diff ]   ON  COLUMNS 
FROM   [ AWCube ]  
WHERE   [ Measures ] . [ Internet Sales Amount ]  

 

你可能感兴趣的:(procedure)