Skip to main content
Top

2023 | Book

Pro DAX and Data Modeling in Power BI

Creating the Perfect Semantic Layer to Drive Your Dashboard Analytics

insite
SEARCH

About this book

Develop powerful data models that bind data from disparate sources into a coherent whole. Then extend your data models using DAX–the query language that underpins Power BI–to create reusable measures to deliver finely-crafted custom calculations in your dashboards.
This book starts off teaching you how to define and enhance the core structures of your data model to make it a true semantic layer that transforms complex data into familiar business terms. You’ll learn how to create calculated columns to solve basic analytical challenges. Then you’ll move up to mastering DAX measures to finely slice and dice your data.
The book also shows how to handle temporal analysis in Power BI using a Date dimension. You will see how DAX Time Intelligence functions can simplify your analysis of data over time. Finally, the book shows how to extend DAX to filter and calculate datasets and develop DAX table functions and variables to handle complex queries.

What You Will LearnCreate clear and efficient data models that support in-depth analyticsDefine core attributes such as data types and standardized formatting consistently throughout a data modelDefine cross-filtering settings to enhance the data model
Make use of DAX to create calculated columns and custom tablesExtend your data model with custom calculations and reusable measures using DAXPerform time-based analysis using a Date dimension and Time Intelligence functions

Who This Book Is For
Everyone from the CEO to the Business Intelligence developer and from BI and Data architects and analysts to power users and IT managers can use this book to outshine the competition and create the data framework that they need and interactive dashboards using Power BI

Table of Contents

Frontmatter
Chapter 1. Using Power BI Desktop to Create a Data Model
Abstract
Power BI’s ability to access and load data from a wide variety of sources is undeniably one of the keys to its success as a world leading analytics tool. Yet simply fetching a lot of data does not by itself make creating accurate and informative interactive dashboards possible even in Power BI.
Adam Aspin
Chapter 2. Extending the Data Model
Abstract
In the first chapter you learned how to join tables to create a data model that you can use to analyze data across a set of tables. This is the necessary first step to delivering a structured data model. However, it is only a first step. This initial structure needs to be developed and polished to enable it to deliver the analytics that you require. So in this chapter you will see how to extend the core data model by
Adam Aspin
Chapter 3. The Semantic Layer
Abstract
In the two previous chapters, you learned how to take separate tables and join them together in a way that allows you to query data across multiple source data elements. You then saw how to add further elements to shape the data model to make it easier to use and maintain.
Adam Aspin
Chapter 4. Calculated Columns
Abstract
This chapter further develops the dimensional data model that you saw in the previous chapter. It will explain how to augment the existing tables that you have imported by adding new columns containing calculations. You can then apply the output from these calculated columns to the dashboards that you create using Power Bi Desktop.
Adam Aspin
Chapter 5. Calculating Across Tables
Abstract
In the previous chapter you started on the journey to extending a data model with calculated columns. This approach was limited to adding calculated columns that only referenced columns inside the current table. However it is possible in most cases to create a calculated column that uses the relationships between tables in the data model to create calculations that refer to columns in other tables. This is the next step in learning how to use DAX for calculated columns.
Adam Aspin
Chapter 6. DAX Logical Functions
Abstract
Analytics frequently involves applying some core logic to data. So it will probably come as no surprise to learn that DAX (rather like Excel) contains a set of logical functions that you can use to add indicators to data as well as grouping and classifying data.
Adam Aspin
Chapter 7. Date and Time Calculations in Columns
Abstract
It is virtually inevitable that, at some point in your analytics career with Power BI, you will need to look at how data evolves over time. So it is equally inevitable that you will need at some point to add calculations based on dates.
Adam Aspin
Chapter 8. Introduction to Measures
Abstract
Now that you have a thorough grounding in calculated columns, it is time to boost your DAX abilities by getting to grips with measures in DAX. Measures are a second - and arguably far more powerful - way of applying calculations in Power BI. They are, however, very different in their scope and application to column-based calculations. I cannot deny that they can be more difficult to understand and apply in many cases. Yet mastering measures is key to unleashing the full potential of Power BI as an analytics tool.
Adam Aspin
Chapter 9. Filtering Measures
Abstract
One of the most powerful aspects of measures in DAX is that they can be tweaked and tuned to filter the output that they deliver. This means that you can use them to create targeted calculations that only display the results based on a specific subset of the data in the data model - rather than all the data defined by any implicit filter selection. This opens the doors to endless ways to compare and contrast results and consequently deliver in-depth analysis of your data.
Adam Aspin
Chapter 10. CALCULATE() Modifiers
Abstract
This chapter will continue explaining the CALCULATE() function. As I mentioned (and as you may have discovered if you have started writing DAX) CALCULATE() is the most complex - as well as the most powerful and probably the most useful - function available in DAX. So we need now to move on to the next level of understanding of what this function can deliver.
Adam Aspin
Chapter 11. The Filter() Function
Abstract
In Chapter 9 we have looked at filtering data using (fairly) simple comparisons applied as parameters to the CALCULATE() function. These kinds of data filters are both simple and efficient, but they have limits on what they can achieve. This chapter will push the boundaries of what can be done to select and subset data through introducing you to the FILTER() function.
Adam Aspin
Chapter 12. Iterators
Abstract
In the previous chapter you discovered how to use the FILTER() function to reduce the scope of calculations. In fact, when you learned about FILTER(), you learned how to create an iterator function. Iterators - to give them their usual name - are a set of DAX functions that allow you to process dataset tables (or even the virtual tables that you will learn about in Chapter 16) and add calculations.
Adam Aspin
Chapter 13. Creating and Applying a Date Dimension
Abstract
DAX is extremely good at analyzing data over time. This is done using a series of DAX functions that simplify analysis that use dates as a core aspect of the analytics. This kind of analysis is called Time Intelligence.
Adam Aspin
Chapter 14. Time Intelligence
Abstract
Much data analysis - and nearly all business intelligence - involves looking at how metrics evolve over time. You may need to aggregate sales by month, week, or year for instance. Perhaps you want to compare figures for a previous month, quarter, or year with the figures for a current period. Whatever the exact requirement, handling time (by which we nearly always mean dates) is essential in Power BI Desktop.
Adam Aspin
Chapter 15. DAX Variables
Abstract
As you have progressed through the chapters of this book, you have seen how DAX code can increase in complexity as you have to solve more interesting analytical challenges. While there is nothing inherently wrong with intricate code structures that deliver a valid result, long and convoluted DAX measures can be both hard to write and even harder to debug and maintain.
Adam Aspin
Chapter 16. Table Functions
Abstract
One frequent DAX challenge that many users face is the need to deliver highly specific, often comparative, data. You may be required, say, to look at how data overlaps when different criteria are applied. Maybe you will need to look at disparate subsets of data and compare and contrast (or even summarize) them.
Adam Aspin
Chapter 17. Beyond the Data Model
Abstract
Up until now this book has taught you how to create DAX that is built upon (and uses) a basic Power BI data model. Essentially this meant
Adam Aspin
Chapter 18. Evaluation Context
Abstract
When developing DAX formulas in this book, you have essentially seen how to produce formulas that deliver the results that you expect. Now that you have seen the how – and to conclude your introduction to DAX - it is time to move on to an initial understanding of why DAX formulas work as they do.
Adam Aspin
Backmatter
Metadata
Title
Pro DAX and Data Modeling in Power BI
Author
Adam Aspin
Copyright Year
2023
Publisher
Apress
Electronic ISBN
978-1-4842-8995-2
Print ISBN
978-1-4842-8994-5
DOI
https://doi.org/10.1007/978-1-4842-8995-2

Premium Partner