SSAS MDX and TSQL

OLAP allows users to discovery new insights using BI applications like Business Objects and Microsoft SSRRS and SSAS.  MOLAP  traditionally can be implemented as cube  but newer technologies has made it possible to design MOLAP in a  tubular format similar to pivot tables with the introduction of SSAS 2012 which is much easier.

MDX queries can be called within Stored Procedures, User-defined Functions and Views using linked server. This gives the user the ability to manage the output in various format. Users  without knowledge of MDX queries  can utilized these database objects for various reports.  Learning  to write MDX queries can be hard for non technical experts.

The link server has to be created first in the process between the host SQL Database and SSAS Cube. For this demonstration SQL Server 2008 is being utilized.



Normal MDX query




Notice the difference between MDX and regular TSQL or SQL Statements. You have to know the hierarchy and how they are organized base on the subjects and dimensions.  To add the filter you have to write a different statement within the From section.  I am still learning more about the MDX  and SSAS.  Implementing MDX with regular SQL statements to create regular database objects eliminates the need to learn MDX queries. Since most vendors offers a link type technology  between their host platform and SQL Server it would make the connection to SSAS much easier.

View


  


Once the view has been created   you can now query the database.






Additional filter can be implemented to restrict the flow of data.





User-defined Function 

The first UDF which is table based  has no parameters to filter the data.  I decided to use open query format to make it easier to read the script. A where filter can be included to restrict the flow of data.








I have included the where filter to restrict the data to a specific country.




The same UDF has been modified to include parameters which allows the user to filter the data based on input parameters added to the where section of the query.






Stored Procedures






Reports

I would utilized the view created earlier to create report using Microsoft Excel power pivot. 



In the next report i would utilize the Reseller_Sales_udf to create reports from Excel.






XML

SQL Server like many other vendor has XML embedded to produce XML styles.












Comments

Popular posts from this blog

ETL ( Automation vs Manual )

Data Migration

SSIS, SSAS & Stored Procedure