DAX Level 1
• What version of PowerPivot do I have?
• What is DAX?
• Concepts – Data Model, Measures
• Exercise – Simulate Filtering
• DAX – Level 1
• Exercise – Writing DAX
DAX Level 1
History of Power Pivot
2010
History of Power Pivot
2010
Version 1
Excel 2010
History of Power Pivot
2010
Version 1
Excel 2010
2013
Version 2
Excel 2010 +
2013
History of Power Pivot
2010
Version 1
Excel 2010
2013
Version 2
Excel 2010 +
2013
2015
Version 2.x
Power BI
Desktop
History of Power Pivot
2010
Version 1
Excel 2010
2013
Version 2
Excel 2010 +
2013
2016
Version 2.x
Excel 2016
2015
Version 2.x
Power BI
Desktop
Excel->File->Options
File->Options
What is DAX?
Data Analysis eXpressions
DAX is a function language like
Excel.
SUM() COUNT() AVERAGE()
CALCULATE()
Minority Report
Minority Report
DAX is Minority Report Programing
- Measures that just work.
DAX is Minority Report Programing
- Measures that just work.
DEMO
DAX allows you to program what a
metric will do when it is dragged
around.
The model handles all the
relationships… but you still need to
worry about it.
“The hard part is
what you are not specifying.”
-Ken Raetz
Data Model
Tools & Knowledge Level
Week 1
Tools & Knowledge Level
Week 1Week 2
Tools & Knowledge Level
Week 1Week 2 Week 3
Tools & Knowledge Level
DAX Measures
DAX Measures
Sum()
Total Spend
Total Qty
Simulate Filtering
#1 - Pick a cell in the pivot
#1 - Pick a cell in the pivot
#2 - Picture filters reducing data in
the model
#3 - After filtering, apply math
#3 - After filtering, apply math
#3 – After filtering, apply math
Simulate Filtering Demo
Exercise - Simulate Filtering
Count()
Total Vendors
Total Items
Countrows()
Total Transactions
Distinctcount()
Vendors that Have Transactions
Items Purchased
Max(), Min(), Average()
Avg Unit Price
Max Unit Price
Min Unit Price
Divide()
Avg Vendor Spend Amt
Exercise 1
• Sum()
• Total Spend
• Total Qty
• Count()
• Total Vendors
• Total Items
• Countrows()
• Total Transactions
• Distinctcount()
• Vendors that Have
Transactions
• Items Purchased
• Max(), Min(), Average()
• Avg Unit Price
• Min Unit Price
• Max Unit Price
• Divide()
• Avg Vendor Spend Amt
DAX Level 2 & 3
• DAX - Level 2
• Concept - Calculated Columns
• DAX - Level 3
• Break
• Exercise - Writing DAX
DAX Level 2 & 3
DAX Level 2
YTD
March
YTD
March
YTD
March
CALCULATE()
Calculate()
On Contract
Off Contract
GPO Coverage
Compliance %
CALCULATE([measure], <filter1>, <filter2>, … <filterN>)
#1 - Pick a cell in the pivot
#1 - Pick a cell in the pivot
#2 – Got DAX Filters?
Sales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)
Sales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)
Sales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)
Sales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)
2016
#3 - Picture filters reducing data in
the model
2016
#4 - After filtering, apply math
#4 - After filtering, apply math
#4 - After filtering, apply math
2 Types of Filters:
Simple Filters & Advanced Filters
2 Types of Filters:
Simple Filters & Advanced Filters
CALCULATE([measure], <filter1>, <filter2>, … <filterN>)
2 Types of Filters:
Simple Filters & Advanced Filters
CALCULATE([measure], <filter1>, <filter2>, … <filterN>)
Simple Calculate Filter
Sales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)
Fixed value
Simple Calculate Filter
Sales Customer BCD = CALCULATE([Sales], 'Customer'[Name] = "BCD")
Fixed value
Calculate()
On Contract
Off Contract
Optional
Compliance %
DAX Level 3
Concept – Calculated Columns
Demo Total Spend in the item table.
SumX() MaxX() AverageX()
Max Item Total Spend
What If Savings
MAXX('table',[measure])
What If Off was On Amount :=SUMX ('Item',
IF ([Off Contract Avg Unit Price] > [On Contract Avg Unit Pric
e],[Off Contract Qty] * [On Contract Avg Unit Price])
)
What If Savings :=SUMX ( 'Item', [What If Off was On Amou
nt] - [Off Contract] )
Exercise
• Calculate()
• On Contract
• Off Contract
• Optional
• Compliance %
• MaxX()
• Max Item Total Spend

DAX and Power BI Training - 002 DAX Level 1 - 3