Book Image

Hands-On SQL Server 2019 Analysis Services

By : Steve Hughes
Book Image

Hands-On SQL Server 2019 Analysis Services

By: Steve Hughes

Overview of this book

SQL Server Analysis Services (SSAS) continues to be a leading enterprise-scale toolset, enabling customers to deliver data and analytics across large datasets with great performance. This book will help you understand MS SQL Server 2019’s new features and improvements, especially when it comes to SSAS. First, you’ll cover a quick overview of SQL Server 2019, learn how to choose the right analytical model to use, and understand their key differences. You’ll then explore how to create a multi-dimensional model with SSAS and expand on that model with MDX. Next, you’ll create and deploy a tabular model using Microsoft Visual Studio and Management Studio. You'll learn when and how to use both tabular and multi-dimensional model types, how to deploy and configure your servers to support them, and design principles that are relevant to each model. The book comes packed with tips and tricks to build measures, optimize your design, and interact with models using Excel and Power BI. All this will help you visualize data to gain useful insights and make better decisions. Finally, you’ll discover practices and tools for securing and maintaining your models once they are deployed. By the end of this MS SQL Server book, you’ll be able to choose the right model and build and deploy it to support the analytical needs of your business.
Table of Contents (19 chapters)
1
Section 1: Choosing Your Model
4
Section 2: Building and Deploying a Multidimensional Model
8
Section 3: Building and Deploying Tabular Models
12
Section 4: Exposing Insights while Visualizing Data from Your Models
15
Section 5: Security, Administration, and Managing Your Models

One last thing – our sample data

This is the final preparation piece before we build the Analysis Services models. We will be using the latest Microsoft sample database from Wide World Importers. The Wide World Importers data warehouse sample is a star schema database. While a number of cool features have been added and can be explored in the data warehouse, our focus is on source data for our Analysis Services models.

You can find the World Wide Importers sample databases on GitHub: https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0. For our purposes, you only need the WideWorldImportersDW-Full.bak file. If you are interested in the features for the transactional database, which is the actual source for the data warehouse, you can also download WideWorldImporters-Full.bak. If you get both samples, you will need 10 GB of storage for the databases and a minimum of 1.5 GB of RAM to support them.

The sample databases use the latest features of SQL Server 2019

This is a warning for if you choose to install both databases on your server. Both use in-memory features, which could cause performance issues on your computer. These features are meant to highlight some of the latest features but can be resource-intensive. If this is a concern, you should not restore the transactional database at this time.

Once you have the backup file downloaded, I would recommend you move the file to the Backup folder located where you selected during the install process. This folder will be easily discoverable from SSMS during the restore process. This is not required, but I find it a good practice in most cases.

Restoring the data warehouse backup

Let's restore the database now:

  1. Open up SQL Server Management Studio.
  2. Connect to your SQL Server 2019 database instance.
  3. Right-click on the Databases folder and select Restore Database…:
    Figure 1.29 – Select Restore Database…

    Figure 1.29 – Select Restore Database…

  4. In the Restore Database… dialog, choose Device.
  5. Then use the ellipses button to open a dialog box that will allow you to choose the WideWorldImportersDW-Full.bak file. Click Add to find your backup file.
  6. Once selected, your dialog should be filled in similar to the following:
    Figure 1.30 – Your dialog box should look like this

    Figure 1.30 – Your dialog box should look like this

  7. Next, select OK. This will take some time, but you should see the restored database in Management Studio when the process is complete.

    You can also use a script to restore the backup as shown here. You will need to replace {YOUR PATH HERE} with the location of your files:

    USE [master]
    RESTORE DATABASE [WideWorldImportersDW] 
    FROM  DISK = N'{YOUR PATH HERE}\MSSQL\Backup\WideWorldImportersDW-Full.bak' 
    WITH  FILE = 1,  
    MOVE N'WWI_Primary' TO N'{YOUR PATH HERE}\MSSQL\DATA\WideWorldImportersDW.mdf',  
    MOVE N'WWI_UserData' TO N'{YOUR PATH HERE}\MSSQL\DATA\WideWorldImportersDW_UserData.ndf',  
    MOVE N'WWI_Log' TO N'{YOUR PATH HERE}\MSSQL\DATA\WideWorldImportersDW.ldf',  
    MOVE N'WWIDW_InMemory_Data_1' TO N'{YOUR PATH HERE}\MSSQL\DATA\WideWorldImportersDW_InMemory_Data_1',  
    DOWNLOAD,  
    STATS = 5
    GO

Whichever option you choose to use, this will result in a restored database for us to use in later chapters.