Book Image

Hands-On Business Intelligence with DAX

By : Ian Horne
Book Image

Hands-On Business Intelligence with DAX

By: Ian Horne

Overview of this book

Data Analysis Expressions (DAX) is known for its ability to increase efficiency by extracting new information from data that is already present in your model. With this book, you’ll learn to use DAX’s functionality and flexibility in the BI and data analytics domains. You’ll start by learning the basics of DAX, along with understanding the importance of good data models, and how to write efficient DAX formulas by using variables and formatting styles. You’ll then explore how DAX queries work with the help of examples. The book will guide you through optimizing the BI workflow by writing powerful DAX queries. Next, you’ll learn to manipulate and load data of varying complexity within Microsoft products such as Power BI, SQL Server, and Excel Power Pivot. You’ll then discover how to build and extend your data models to gain additional insights, before covering progressive DAX syntax and functions to understand complex relationships in DAX. Later, you’ll focus on important DAX functions, specifically those related to tables, date and time, filtering, and statistics. Finally, you’ll delve into advanced topics such as how the formula and storage engines work to optimize queries. By the end of this book, you’ll have gained hands-on experience in employing DAX to enhance your data models by extracting new information and gaining deeper insights.
Table of Contents (18 chapters)
1
Section 1: Introduction to DAX for the BI Pro
7
Section 2: Understanding DAX Functions and Syntax
14
Section 3: Taking DAX to the Next Level

It's a date

In this section, we will look at how you can use DAX, with the create table function, to create a custom date table.

In our data model, we already have some date tables. However, as we have seen, there are no dates prior to December 1, 2011. In the Product table, we have products that have values in the Available For Sale Date field that are before this date. To get around this issue, we are going to create a custom date table that covers all of the dates referenced in the Product table.

To start, we will need to create a calculated table. From Power BI Desktop, follow these steps:

  1. Switch to the Report or Data view.
  2. From the Calculations section of the Modeling ribbon, select Create New Table. This will bring up the DAX editor, where we can name the table and add the DAX expression to define it. In the DAX editor, enter the following expression to create the...