This document discusses various DAX functions for filtering and context transition including CALCULATE, ALL, and FILTER. It provides examples of how to use these functions to filter a dataset by year and date to calculate year-to-date measures, filter to non-diversified suppliers, and compare metrics for the current and prior year-to-date periods. It also recommends exercises and homework using these functions with real-world data and discusses the topics that will be covered in the next session.
35. Sales YTD :=
CALCULATE (
[Sales],
)
Date Year
1/1/2016 2016
1/2/2016 2016
… …
2/28/2016 2016
2/29/2016 2016
36. 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
37. 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.
38. Exercise
• ALL()
• Qty % of Vendors
• FILTER()
• Non-Diversified Suppliers
• ALL() and FILTER()
• On Contract YTD
• On Contract LYTD
40. 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
41. Next Week
• Beginner Power Pivot
• Logical Functions IF() and SWITCH()
• Time Intelligence Functions
• Budget vs Actual or Benchmark vs Actual