As we all know, SQL Server Analysis Service (SSAS) is an analytical data engine used in decision support and business analytics. It provides enterprise-grade semantic data models for business reports and client applications, such as Power BI, Excel, Reporting Services reports, and other data visualization tools.

We will try to implement the same workflow to show how we can do data analysis in SSAS. I have divided this in two parts,

Let’s get started with this example.

Prerequisite

Note
It is very important to know the compatibility of SQL Server version that we will use. Please see this Microsoft Article for compatibility details.

Data

We will use “Adventure Works” Database to develop sample tabular model. We can download this database backup file from here.

In the below mentioned tables, we are going to create the tabular model.

TablesDescription
CustomerThis table contains information related to the customer. i.e. name, address etc.
PersonThis is more specific information related to Person
ProductThis table contains Product details.
DemoSalesOrderHeaderSeedThis table contains Sales Order Header information. i.e. date, customer info etc.
DemoSalesOrderDetailSeedThis table contains Sales Order Detail.

Tabular Modeling

Now, we will create a Visual Studio Solution for the Tabular model.

Relationship

Now we define one to many relationships between data. So, we can enable bi-directional cross filters in tabular model and no need to write custom DAX formula for filter data.

Click Diagram View in tabular model.

SQL Server

Right Click a table heading or column, and then click Create Relationship.

SQL Server

Please see this detail article about relationships by Microsoft.

Measures

A measure is a calculation on entire column using DAX formula for reporting purposes; i.e. product count, customer count, sum of product price etc.

Click Model View in tabular model and We will add below Measures in Model,

  1. Distinct Count of Customer:=DISTINCTCOUNT([CustomerID])
  2. Total of OrderQty:=SUM([OrderQty])
  3. Distinct Count of Product:=DISTINCTCOUNT([ProductID])

To add measures click on the column for which we want to create the measure, and then click the Column menu as below,

SQL Server

Please see this detail article about measures by Microsoft.

Hierarchies

Hierarchies are metadata that define relationships between two or more columns in a table and Hierarchies can appear separate from other columns in a reporting.

Here we create date hierarchy to show usage of hierarchies in tabular model so we have two more column month, year based date in “DemoSalesOrderHeaderSeed” table.

SQL Server
Click on Diagram View in a table window, right-click on a column, and then click Create Hierarchy.
SQL Server SQL Server

Please see this detail article about hierarchy by Microsoft.

Roles

As we know, Roles define member permissions for a model. Members of the role can perform actions on the model as defined by the role permission. Here we define two roles, tabular user who has read permission on model and tabular admin who has admin permission on model.

Right Click on roles in Tabular Model Explorer and add roles on model.

SQL Server

Please see this detail article about roles by Microsoft.

Now we have successfully built Tabular Model and are ready to deploy it to server. There are few simple step for deployment as mentioned below.

Go to solution explorer, right click on model. Click on deploy. Let's connect analysis server and we see deployed tabular model as in the below screenshot,

SQL Server

Conclusion

In article, we have learned about how we can create SSAS tabular model and setup measure, roles, calculated columns, and hierarchies in tabular modeling.

I have attached an example solution with this article for reference.

In the next part, we will see how business users can do data analysis on SSAS tabular model in excel.

Hope you will love this article.