Create a tabular model in Azure Analysis Services

This tutorial guides you through creating a tabular model in Azure Analysis Services. This model will be used to create interactive reports and dashboards.

Prerequisites:
  • An Azure subscription.
  • An Azure Analysis Services instance.
  • SQL Server Data Tools (SSDT) installed.

Step 1: Create a New Tabular Project

1.1 Open Visual Studio and Create a New Project

Launch Visual Studio and select File > New > Project.

In the Create a new project dialog, search for "Analysis Services" and select the Tabular project template. Click Next.

1.2 Configure Project Settings

Enter a Project name (e.g., SalesTabularModel) and choose a Location. Click Create.

In the Tabular Model Designer dialog:

  • Target Designer Version: Select the latest available version.
  • Model Source: Choose Tabular.
  • Compatibility Level: Select a compatibility level appropriate for your Azure Analysis Services instance.
  • Model Name: Enter a name for your model (e.g., SalesModel).

Click OK.

Step 2: Connect to a Data Source

2.1 Add a New Data Source

In Solution Explorer, right-click on the Data Sources folder and select Add Data Source.

In the Table import wizard, select SQL Server as the data source type. Click Next.

2.2 Configure Data Source Connection

Server name: Enter the name of your Azure Analysis Services server instance (e.g., yourservername.asazure.windows.net).

Database name: Enter the name of the database you want to connect to (e.g., a SQL database containing your sales data).

Select the appropriate Authentication method (e.g., Service Principal or SQL Authentication) and provide credentials. Click Next.

Verify the connection by clicking Test Connection. Click Next, then Finish.

Step 3: Import Tables

3.1 Select Tables and Views

In the Table import wizard, you will see a list of tables and views from your selected database.

Select the tables that contain your sales data, such as SalesOrderHeader, SalesOrderDetail, Product, and Customer. Click Next.

Table selection in import wizard

Figure 1: Selecting tables in the Table import wizard.

3.2 Review Column Selection

You can optionally deselect columns you don't need. Click Finish.

The wizard will import the selected tables into your tabular model.

Step 4: Create Relationships

4.1 Open the Model View

In Solution Explorer, double-click the Model.bim file to open the model designer.

Click the Diagram View icon at the bottom of the designer to see your tables.

4.2 Create Relationships

Drag and drop the foreign key column from one table to the primary key column in another table to create a relationship. For example, drag SalesOrderID from SalesOrderDetail to SalesOrderID in SalesOrderHeader.

Ensure relationships are created between all related tables (e.g., Product to SalesOrderDetail, Customer to SalesOrderHeader).

Relationship diagram in model designer

Figure 2: Creating relationships between tables.

Step 5: Create Measures

5.1 Add a New Measure

In the Model Designer, right-click on the table where you want to create a measure (e.g., SalesOrderDetail) and select Add New Measure.

5.2 Define the Measure

In the Measure Properties pane:

  • Name: Enter a descriptive name, e.g., Total Sales Amount.
  • Table: Ensure it's set to the correct table.
  • Description: Optionally add a description.
  • Format: Set the format (e.g., Currency).

In the Formula box, enter a DAX (Data Analysis Expressions) formula. For example:

SUM(SalesOrderDetail[LineTotal])

Press Enter to save the measure.

5.3 Create Additional Measures

Repeat the process to create other useful measures, such as:

  • Order Count: COUNTROWS(SalesOrderHeader)
  • Average Sale Amount: AVERAGE(SalesOrderDetail[LineTotal])

Step 6: Deploy the Model

6.1 Configure Deployment Properties

In Solution Explorer, right-click on the project name (e.g., SalesTabularModel) and select Properties.

In the Properties window, set the Server name to your Azure Analysis Services instance name (e.g., yourservername.asazure.windows.net).

Optionally, change the Database name if you want it to be different on the server.

6.2 Deploy the Project

Right-click on the project name in Solution Explorer and select Deploy.

Visual Studio will build and deploy the model to your Azure Analysis Services instance. Monitor the Output window for deployment progress and any errors.

Deployment progress window

Figure 3: Monitoring deployment progress in Visual Studio.

Once deployment is successful, you can connect to this model from tools like Power BI or Excel to create reports.

Next Steps

Now that you have created and deployed your tabular model, you can: