Companion content
Insert your email address and press Download for access to the files used in this book.Errata corrige
To ensure the ongoing accuracy of this book and its companion content, we have reviewed and confirmed the errors listed below. If you find a new oversight not included in both of the following sections, please report it to us.
Important issues
Corrections in this section are important to fully understand the concepts explained in the book.-
Page 59: DISTINCT can operate on a table
The third paragraph in the page contains the following text:
In this case, you cannot use DISTINCT over a table; in case there are duplicated rows, you do not have a single DAX function to remove duplicated rows (you have to use SUMMARIZE instead, which you will see later in Chapter 9).
More recent versions of DAX introduced the ability to use a table as an argument of DISTINCT. Thus, the previous sentence should be changed to:
In recent versions of DAX, you can use DISTINCT over a table. In Analysis Services 2012/2014 and Power Pivot for Excel 2013, in case there are duplicated rows, you did not have a single DAX function to remove duplicated rows (you had to use SUMMARIZE instead, which you will see later in Chapter 9).
-
Page 127: Activation of relationships
The example at page 127 is wrong, because the result of FILTER has the default relationship active and ignores the USERELATIONSHIP function used within CALCULATE and CALCULATETABLE.
The right formula to achieve the result is the following:TotalSalesDeliveryDateIn2007 := CALCULATE ( [Sales Amount], USERELATIONSHIP ( Sales[DeliveryDateKey]; 'Date'[DateKey] ), 'Date'[Calendar Year] = 2007 )
The problem of the code that does not work requires the understanding of expanded tables, described later in the book. Just ignore the example at page 127 and the last paragraph at page 126. The USERELATIONSHIP function activates the desired relationship and it works well for column filters, whereas the effect is not intuitive with table filters, which are considered as expanded tables.
-
Page 153: Prices table name is called Fixing in sample file
The table Prices is called Fixing in the sample file Chapter06_Static Moving Averages.xlsx
-
Page 191: First code block
The first code block should contain the following code instead of the current one:
FILTER ( ALL ( 'Date'[Date] ), AND ( 'Date'[Date] > DATE ( YEAR ( MAX ( 'Date'[Date] ) ) - IF ( MONTH ( MAX ( 'Date'[Date] ) ) <= <month>, 1, 0 ), <month>, <day> ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
-
Page 216: All code blocks until page 218
In all the code boxes in page 216, 217, and 218, replace:
HASONEVALUE ( 'Product Category' )
with
HASONEVALUE ( 'Product Category'[ProductCategoryKey] )
-
Page 270: Wrong table in UNION example (1/2)
The example at page 270 is wrong, the CALCULATETABLE function must execute ‘Product Subcategory’ at the third row instead of ‘Product Category’.
The right code is:EVALUATE CALCULATETABLE ( 'Product Subcategory', UNION ( CALCULATETABLE ( SELECTCOLUMNS ( 'Product Subcategory', "Code 1", 'Product Subcategory'[Subcategory Code] ), 'Product Subcategory'[Subcategory Code] = "0601" || 'Product Subcategory'[Subcategory Code] = "0602" ), CALCULATETABLE ( SELECTCOLUMNS ( 'Product Subcategory', "Code 2", 'Product Subcategory'[Subcategory Code] ), 'Product Subcategory'[Subcategory Code] = "0702" ) ) )
The result displayed at page 271 should include rows from the Product Subcategory table, too:
ProductSubcategoryKey Subcategory Code Subcategory ProductCategoryKey 34 0601 Music CD 6 35 0602 Movie DVD 6 39 0702 Download Games 7 -
Page 271: Wrong table in UNION example (2/2)
The example at page 272 is wrong, the CALCULATETABLE function must execute ‘Product Subcategory’ at the third row instead of ‘Product Category’.
The right code is:EVALUATE CALCULATETABLE ( 'Product Subcategory', UNION ( CALCULATETABLE ( SELECTCOLUMNS ( 'Product Subcategory', "Code 1", 'Product Subcategory'[Subcategory Code] ), 'Product Subcategory'[ProductCategoryKey] = 6 ), ROW ( "Code 2", "0702" ) ) )
The result displayed at page 271 should include rows from the Product Subcategory table, too:
ProductSubcategoryKey Subcategory Code Subcategory ProductCategoryKey 1 0101 MP4-MP3 1 2 0102 Recorder 1 3 0103 Radio 1 … … … …