Professional Documents
Culture Documents
DAX Workshop Slides
DAX Workshop Slides
Mitchell Pearson
[email protected]
www.youtube.com/c/MitchellPearson
www.mitchellpearson.com
@MitchellSQL
What is DAX
Introduction to DAX
What is DAX?
Data Analysis Expressions
Expression Language for Power BI, Power Pivot and
SSAS Tabular
DAX
Why DAX?
Designed to Support a Larger User Base
Simpler than Traditional Technical Languages to Learn
Leverage Existing Knowledge of Excel Formulas
Less of a Learning Curve for Analyst
What is DAX Used For?
Calculated Columns
Create New Columns on a table
Method for Connecting Disparate Data Sources with Multiple Key
Columns
Calculated Measures
Create Dynamic Calculations for Reporting
Time Intelligence
Calculated Tables
Create a new table derived from another table
Can be used to create a date table when one doesn’t exist already
Navigation Functions
Similar to VLOOKUP in EXCEL or a JOIN in SQL
Navigation Functions
RELATED
Returns a value from a connected table
RELATEDTABLE
Returns a table from a connected table
Requirements
Relationship must exist for these to work
Demo
Why Calculate?
Apply a filter(s) to an expression.
Ratios / Percent of Totals
Syntax
CALCULATE(<expression>,<filter1>,<filter2>…)
Expression is an aggregate
Filters Add to or Override Filter Context
ResellerSales:=CALCULATE([TotalSales],Store[StoreType]="Reseller")
AllProductSales:=CALCULATE([TotalSales], ALL(Product))
Semi-Additive Measures
Inventory Levels
Account Balances
Time Intelligence in DAX
Requirements
Date Table
One Row for Every Date (No gaps)
Span Range of Possible Dates
Time Intelligence Functions
CLOSINGBALANCEMONTH ENDOFMONTH DATESMTD
CLOSINGBALANCEQUARTER ENDOFQUARTER DATESQTD
CLOSINGBALANCEYEAR ENDOFYEAR DATESYTD
DATESINPERIOD PARALLELPERIOD SAMEPERIODLASTYEAR
DATESBETWEEN PREVIOUSDAY OPENINGBALANCEMONTH
DATEADD PREVIOUSMONTH OPENINGBALANCEQUARTER
FIRSTDATE PREVIOUSQUARTER OPENINGBALANCEYEAR
LASTDATE PREVIOUSYEAR TOTALMTD
LASTNONBLANKDATE NEXTDAY TOTALQTD
STARTOFMONTH NEXTMONTH TOTALYTD
STARTOFQUARTER NEXTQUARTER
STARTOFYEAR NEXTYEAR
Demo
Calculated Measures
Pragmatic Works Training:
Live Virtual training events: DAX Boot Camps
On-Demand Learning
20% OFF On-Demand Learning with Coupon Code: DAX20
https://tinyurl.com/PragmaticWorksTraining