MDX Procedure Based on .NET
2009-06-11 00:48 Yin.P 阅读(746) 评论(1) 编辑 收藏 举报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.
{
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.
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]