MDX Procedure Based on .NET

↘锁芯ラ 提交于 2019-12-31 05:00:52

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] 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!