dax and power bi training - 005 dax level 4
TRANSCRIPT
![Page 1: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/1.jpg)
DAX Level 4
![Page 2: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/2.jpg)
![Page 3: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/3.jpg)
YTD
March
![Page 4: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/4.jpg)
YTD
March
![Page 5: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/5.jpg)
YTD
March
![Page 6: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/6.jpg)
CALCULATE() with ALL() and FILTER()
![Page 7: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/7.jpg)
2 Types of Filters:
Simple Filters & Advanced Filters
CALCULATE([measure], <filter1>, <filter2>, … <filterN>)
![Page 8: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/8.jpg)
2 Types of Filters:
Simple Filters & Advanced Filters
CALCULATE([measure], <filter1>, <filter2>, … <filterN>)
![Page 9: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/9.jpg)
ALL()
![Page 10: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/10.jpg)
ALL('table' or 'table'[column])
![Page 11: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/11.jpg)
#1 - Pick a cell in the pivot
![Page 12: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/12.jpg)
#1 - Pick a cell in the pivot
![Page 13: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/13.jpg)
#2 – Got DAX Filters?
Sales All Customers = CALCULATE([Sales],ALL('Customers'))
![Page 14: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/14.jpg)
![Page 15: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/15.jpg)
Sales All Customers = CALCULATE([Sales],ALL('Customers'))
![Page 16: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/16.jpg)
Sales All Customers = CALCULATE([Sales],ALL('Customers'))
![Page 17: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/17.jpg)
Sales All Customers = CALCULATE([Sales],ALL('Customers'))
![Page 18: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/18.jpg)
#3 - Picture filters reducing data in the model
![Page 19: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/19.jpg)
#4 - After filtering, apply math
![Page 20: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/20.jpg)
#4 - After filtering, apply math
![Page 21: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/21.jpg)
#4 - After filtering, apply math
![Page 22: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/22.jpg)
ALL()Qty % of Vendors
![Page 23: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/23.jpg)
FILTER()
![Page 24: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/24.jpg)
FILTER('table',<any filter>)
![Page 25: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/25.jpg)
FILTER()Non-Diversified Suppliers
![Page 26: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/26.jpg)
ALL() and FILTER()
![Page 27: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/27.jpg)
ALL() and FILTER()On Contract YTDOn Contract LYTD
![Page 29: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/29.jpg)
Tip - DAX Step through formula
![Page 30: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/30.jpg)
Sales YTD :=CALCULATE (
[Sales],FILTER (
ALL ( 'Calendar' ),AND (
Calendar[Year] = MAX ( Calendar[Year] ),Calendar[Date] <= MAX ( Calendar[Date] )
))
)
![Page 31: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/31.jpg)
Sales YTD :=CALCULATE (
[Sales],FILTER (
,AND (
Calendar[Year] = MAX ( Calendar[Year] ),Calendar[Date] <= MAX ( Calendar[Date] )
))
)
Date Year
1/1/2014 2014
1/2/2014 2014
… …
12/30/2018 2018
12/31/2018 2018
![Page 32: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/32.jpg)
Sales YTD :=CALCULATE (
[Sales],FILTER (
,AND (
Calendar[Year] = 2016,Calendar[Date] <= “2/29/2016”
))
)
Date Year
1/1/2014 2014
1/2/2014 2014
… …
12/30/2018 2018
12/31/2018 2018
![Page 33: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/33.jpg)
Sales YTD :=CALCULATE (
[Sales],FILTER (
,AND (
True,True
))
)
Date Year
1/1/2014 2014
1/2/2014 2014
… …
12/30/2018 2018
12/31/2018 2018
![Page 34: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/34.jpg)
Sales YTD :=CALCULATE (
[Sales],FILTER (
,True)
))
Date Year
1/1/2014 2014
1/2/2014 2014
… …
12/30/2018 2018
12/31/2018 2018
![Page 35: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/35.jpg)
Sales YTD :=CALCULATE (
[Sales],
)
Date Year
1/1/2016 2016
1/2/2016 2016
… …
2/28/2016 2016
2/29/2016 2016
![Page 36: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/36.jpg)
Sales YTD :=CALCULATE (
[Sales],
)
Date Year
1/1/2016 2016
1/2/2016 2016
… …
2/28/2016 2016
2/29/2016 2016
Filter the Sales table through relationship in the model.
Brand Customer Item Division Requested Ship Date Gross Line Amount
Brand 8 Customer 2 Item No 350 Division 2 1/1/2014 5.49
Brand 8 Customer 2 Item No 350 Division 2 1/2/2014 7.37
… … … … … …
Brand 8 Customer 2 Item No 350 Division 2 4/23/2016 8.45
Brand 8 Customer 2 Item No 350 Division 2 4/24/2016 3.45
![Page 37: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/37.jpg)
Sales YTD :=$9,779,779
Brand Customer Item Division Requested Ship Date Gross Line Amount
Brand 8 Customer 2 Item No 350 Division 2 1/1/2016 3.56
Brand 8 Customer 2 Item No 350 Division 2 1/2/2016 5.07
… … … … … …
Brand 8 Customer 2 Item No 350 Division 2 2/28/2016 4.22
Brand 8 Customer 2 Item No 350 Division 2 2/29/2016 5.8
Do the math and return the value to the cell in the pivot table.
![Page 38: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/38.jpg)
Exercise• ALL()
• Qty % of Vendors
• FILTER()• Non-Diversified Suppliers
• ALL() and FILTER()• On Contract YTD
• On Contract LYTD
![Page 39: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/39.jpg)
DAX Books
![Page 40: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/40.jpg)
Homework• Finish creating metrics
• Explore a real world dataset with Power Query
• Practice your transformation skills by turning the data into something useful
• Share your Power Query experience with Steve
![Page 41: DAX and Power BI Training - 005 DAX Level 4](https://reader031.vdocuments.mx/reader031/viewer/2022012310/58a18c811a28abca5a8b6cf3/html5/thumbnails/41.jpg)
Next Week• Beginner Power Pivot
• Logical Functions IF() and SWITCH()
• Time Intelligence Functions
• Budget vs Actual or Benchmark vs Actual