October 2025
Intermediate to advanced
353 pages
9h 14m
English
This appendix contains the complete DAX query executed to obtain the output shown in Figure 9-7 in Chapter 9, which is the visual matrix for a clustered bar chart displaying Sales and Costs per product category and extended with a visual calculation to calculate the Profit per product category.
DEFINE COLUMN '__SQDS0VisualCalcs'[Profit] = (/* USER DAX BEGIN */ [Sales] - [Costs] /* USER DAX END */) VAR __SQDS0FilterTable = TREATAS({2024}, 'Date'[Year]) VAR __SQDS0Core = SUMMARIZECOLUMNS( ROLLUPADDISSUBTOTAL('Product'[CategoryName], "IsSQDS0GrandTotalRowTotal"), __SQDS0FilterTable, "Sales", '_Measures'[Sales], "Costs", '_Measures'[Costs] ) VAR __SQDS0VisualCalcsInput = SELECTCOLUMNS( KEEPFILTERS( SELECTCOLUMNS( __SQDS0Core, ...Read now
Unlock full access