82
DAX Level 1

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

Embed Size (px)

Citation preview

Nashville.

DAX Level 1

What version of PowerPivot do I have?What is DAX?Concepts Data Model, MeasuresExercise Simulate FilteringDAX Level 1Exercise Writing DAXDAX Level 1

History of Power Pivot

2010

History of Power Pivot

2010Version 1Excel 2010

History of Power Pivot

2010Version 1Excel 20102013Version 2Excel 2010 + 2013

History of Power Pivot

2010Version 1Excel 20102013Version 2Excel 2010 + 2013

2015Version 2.xPower BI Desktop

History of Power Pivot

2010Version 1Excel 20102013Version 2Excel 2010 + 2013

2016Version 2.xExcel 2016

2015Version 2.xPower 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 1Tools & Knowledge Level

Week 1

Week 2Tools & Knowledge Level

Week 1

Week 2

Week 3Tools & Knowledge Level

DAX Measures

DAX Measures

Sum()

Total SpendTotal 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 VendorsTotal Items

Countrows()

Total Transactions

Distinctcount()

Vendors that Have TransactionsItems Purchased

Max(), Min(), Average()

Avg Unit PriceMax Unit PriceMin Unit Price

Divide()

Avg Vendor Spend Amt

Exercise 1

Sum()Total SpendTotal QtyCount()Total VendorsTotal ItemsCountrows()Total Transactions

Distinctcount()Vendors that Have TransactionsItems PurchasedMax(), Min(), Average()Avg Unit PriceMin Unit PriceMax Unit PriceDivide()Avg Vendor Spend Amt

DAX Level 2 & 3

DAX - Level 2 Concept - Calculated ColumnsDAX - Level 3BreakExercise - Writing DAXDAX Level 2 & 3

DAX Level 2

YTDMarch

YTDMarch

YTDMarch

CALCULATE()

Calculate()

On ContractOff ContractGPO CoverageCompliance %

CALCULATE([measure], , , )

#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 FiltersCALCULATE([measure], , , )

2 Types of Filters:

Simple Filters & Advanced FiltersCALCULATE([measure], , , )

Simple Calculate FilterSales 2016 = CALCULATE([Sales],'Calendar'[Year] = 2016)Fixed value

Simple Calculate FilterSales Customer BCD = CALCULATE([Sales], 'Customer'[Name] = "BCD")Fixed value

Calculate()

On ContractOff ContractOptionalCompliance %

DAX Level 3

Concept Calculated Columns

Demo Total Spend in the item table.

SumX() MaxX() AverageX()

Max Item Total SpendWhat If Savings

MAXX('table',[measure])

WhatIfOffwasOnAmount:=SUMX('Item',IF([OffContractAvgUnitPrice]>[OnContractAvgUnitPrice],[OffContractQty]*[OnContractAvgUnitPrice]))WhatIfSavings:=SUMX( 'Item',[WhatIfOffwasOnAmount]-[OffContract])

Exercise

Calculate()On ContractOff ContractOptionalCompliance %MaxX()Max Item Total Spend