SlideShare a Scribd company logo
1 of 30
Download to read offline
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
14 et 15 juin 2019, Paris
Power
Saturday
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
3 communautés pour partager,
échanger et apprendre
Power BI, Data, IA, Power Platform, Office 365, SharePoint, etc.
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Power
Saturday
CALCULATE() - the Swiss Army Knife in DAX
Hans Peter Pfister
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖Senior Consultant Business Intelligence,
IT-Logix AG, Bern / Zurich
❖More than 25 years in Data Analytics & Reporting
❖Co-Leader Power BI PUG Switzerland
❖Power BI & Excel Speaker
❖LinkedIn Trainer, Blog Author
❖
Who I am….
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Who are the participants?
• BI / Reporting Professional?
• Business User (Controlling / Finance, Marketing, others?)
• Experience in DAX?
- none, little, seasoned, Ninja (aka SQLBI)?
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖ Introduction
❖ Evaluation Context – explore how DAX works
❖ Introducing CALCULATE()
❖ Working with Filter conditions from tables / columns:
- Add & Update Filters
- Ignore Filters
❖ Filtering with Measures
❖ Conclusion & Questions
Agenda
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
A Swiss Army Knife…
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Evaluation Context - how DAX works
F
1. Filter evaluation ("initial filter context")
=> Report Filter, Page Filter, Visual Filter,
Slicers, Row Header, Column Header
C
2. CALCULATE() ("explicit" filters)
sets, updates or ignores filters
R
3. Relationships
propagate relations from dimensions to facts (in filter direction)
A
4. Arithmetic
calculating the result according to the formula (e.g. SUM)
Filter
Context
https://www.powerbi-pro.com/en/how-dax-calculates-values/
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
1. Initial Filter Context
Page
Filter
Report
Filter
Visual
Filters
Filters
from
Slicer
Row
Headers
Column
Headers
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
2. Calculate – explicit filter conditions
❖Sales = Sum(Sales[SalesAmount])
=> In this example, there is no explicit filter set
❖Sales = CALCULATE ([Sales];
Products[Color] = "black")
=> explicit filter for products table is set
❖more later…..
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Dimension
Dimension
Dimension
Dimension
Facts
3. Relationship
«one
side»
«many
side»
Filter
direction
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
4. Doing the math
❖Sales = Sum(Sales[SalesAmount])
=> e.g. summing up the surviving rows in the
fact table
❖Sales = CALCULATE ([Sales];
Products[Color] = "black")
=> e.g. summing up the surviving rows in the
fact table
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖Corresponds approximately to the SUMIFS()
function in Excel – but it is more powerful
❖The best friend of every DAX user
❖The only function that can change the
initial filter context!
Introducing CALCULATE()
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Calculate Function
https://dax.guide/calculate/
• The second set of arguments, i.e. the “Filter arguments,” are evaluated and applied first
• Then the expression is evaluated under new “Filter Context"
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖ If there is no existing filter
context, a new filter is added by
the filter parameter
❖ Otherwise, the filter parameter
updates the existing filter context
Two Rules of CALCULATE()
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Adding - changed filter context
Sales of Red items =
CALCULATE(
Sales[Sales];
Products[Color] = "Red")
Products[Product
Category] =
“Accessories"
Products[Product
Category] =
“Accessories"
Date[CalendarYear] =
2012
Date[CalendarYear] =
2012
Products[Color] = "Red")
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Updating - changed filter context
Just Bikes:
CALCULATE(
Sales[Sales];
Products[ProductCategory] =
“Bikes")
Products[Product
Category] = “Bikes"
Date[CalendarYear] =
2012
Products[Product
Category] =
“Accessories"
Date[CalendarYear] =
2012
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Comparison options
CALCULATE() expects filter conditions in the form of
❖ Table[column] = condition (e.g. products[color]="red")
or similar
❖ To the left of the comparison operator
(=, <, >, <=, >=, <>)
a column from a table must be listed.
❖ No measure may be used to the right
of the comparison operator either.
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Comparison options with FILTER()
The following comparison options are allowed with FILTER():
❖ Table[Column] = [Measure]
❖ Table[Column] = Table[Column]
❖ [Measure] = [Measure2]
❖ AND:
<TRUE/FALSE expression1> && < TRUE/FALSE expression2>
❖ OR:
<true/FALSE expression1> || <true/FALSE expression2>
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖DAX Studio https://daxstudio.org/
Useful tools
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
❖CALCULATE() is a mighty weapon
❖Always take a look at the filter context
❖use DAX Studio or a calculated table if
you get stuck
Take Aways
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Hans Peter Pfister
h.p.pfister@powerbi-pro.com
www.powerbi-pro.com
@hp_pfister
www.linkedin.com/in/hans-peter-pfister
Contact me!
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Evaluations
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Merci à nos sponsors
http:// PowerSaturday.com
Silver
Bronze
Gold
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
The European SharePoint, Office 365 & Azure Conference
4 Days 2,500 Delegates 150+ Sessions 120 Speakers
Use code ESPC19SPSP for 10% discount on all tickets
www.sharepointeurope.com
@ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019
Merci!

More Related Content

Similar to Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX

Sales Analytics Using Power BI
Sales Analytics Using Power BISales Analytics Using Power BI
Sales Analytics Using Power BINetwoven Inc.
 
Competitive Analysis Powerpoint Presentation Slides
Competitive Analysis Powerpoint Presentation SlidesCompetitive Analysis Powerpoint Presentation Slides
Competitive Analysis Powerpoint Presentation SlidesSlideTeam
 
Competitive Analysis PowerPoint Presentation Slides
Competitive Analysis PowerPoint Presentation SlidesCompetitive Analysis PowerPoint Presentation Slides
Competitive Analysis PowerPoint Presentation SlidesSlideTeam
 
Train additional employees
Train additional employeesTrain additional employees
Train additional employeesSharonClarkeDee
 
Sas visual-analytics-startup-guide
Sas visual-analytics-startup-guideSas visual-analytics-startup-guide
Sas visual-analytics-startup-guideCMR WORLD TECH
 
Project Investment Analysis And Appraisal PowerPoint Presentation Slides
Project Investment Analysis And Appraisal PowerPoint Presentation SlidesProject Investment Analysis And Appraisal PowerPoint Presentation Slides
Project Investment Analysis And Appraisal PowerPoint Presentation SlidesSlideTeam
 
Business Strategy PowerPoint Presentation Slides
Business Strategy PowerPoint Presentation Slides Business Strategy PowerPoint Presentation Slides
Business Strategy PowerPoint Presentation Slides SlideTeam
 
Business Strategy Powerpoint Presentation Slides
Business Strategy Powerpoint Presentation SlidesBusiness Strategy Powerpoint Presentation Slides
Business Strategy Powerpoint Presentation SlidesSlideTeam
 
Basic Pivot Features In Collabion Charts For SharePoint
Basic Pivot Features In Collabion Charts For SharePointBasic Pivot Features In Collabion Charts For SharePoint
Basic Pivot Features In Collabion Charts For SharePointCollabion Technologies
 
Competitive Analysis Methods And Strategy PowerPoint Presentation Slides
Competitive Analysis Methods And Strategy PowerPoint Presentation SlidesCompetitive Analysis Methods And Strategy PowerPoint Presentation Slides
Competitive Analysis Methods And Strategy PowerPoint Presentation SlidesSlideTeam
 
Game, set and perfect match. Wimbledon and IBM
Game, set and perfect match. Wimbledon and IBMGame, set and perfect match. Wimbledon and IBM
Game, set and perfect match. Wimbledon and IBMSusanna Harper
 
Advertisement PowerPoint Presentation Slides
Advertisement PowerPoint Presentation SlidesAdvertisement PowerPoint Presentation Slides
Advertisement PowerPoint Presentation SlidesSlideTeam
 
Microsoft Power BI
Microsoft Power BIMicrosoft Power BI
Microsoft Power BIGeetika
 
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...Johan-André Jeanville
 
iSPORTiSTiCS investment opportunity 2020
iSPORTiSTiCS investment opportunity 2020iSPORTiSTiCS investment opportunity 2020
iSPORTiSTiCS investment opportunity 2020Vinicius Gholmie
 
Quo vadis Power BI?
Quo vadis Power BI?Quo vadis Power BI?
Quo vadis Power BI?Trivadis
 
Competitive Landscape Module PowerPoint Presentation Slides
Competitive Landscape Module PowerPoint Presentation SlidesCompetitive Landscape Module PowerPoint Presentation Slides
Competitive Landscape Module PowerPoint Presentation SlidesSlideTeam
 
Company Valuation Powerpoint Presentation Slides
Company Valuation Powerpoint Presentation SlidesCompany Valuation Powerpoint Presentation Slides
Company Valuation Powerpoint Presentation SlidesSlideTeam
 

Similar to Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX (20)

Resume LinkedIn
Resume LinkedInResume LinkedIn
Resume LinkedIn
 
Sales Analytics Using Power BI
Sales Analytics Using Power BISales Analytics Using Power BI
Sales Analytics Using Power BI
 
Competitive Analysis Powerpoint Presentation Slides
Competitive Analysis Powerpoint Presentation SlidesCompetitive Analysis Powerpoint Presentation Slides
Competitive Analysis Powerpoint Presentation Slides
 
Competitive Analysis PowerPoint Presentation Slides
Competitive Analysis PowerPoint Presentation SlidesCompetitive Analysis PowerPoint Presentation Slides
Competitive Analysis PowerPoint Presentation Slides
 
Train additional employees
Train additional employeesTrain additional employees
Train additional employees
 
Sas visual-analytics-startup-guide
Sas visual-analytics-startup-guideSas visual-analytics-startup-guide
Sas visual-analytics-startup-guide
 
Project Investment Analysis And Appraisal PowerPoint Presentation Slides
Project Investment Analysis And Appraisal PowerPoint Presentation SlidesProject Investment Analysis And Appraisal PowerPoint Presentation Slides
Project Investment Analysis And Appraisal PowerPoint Presentation Slides
 
Business Strategy PowerPoint Presentation Slides
Business Strategy PowerPoint Presentation Slides Business Strategy PowerPoint Presentation Slides
Business Strategy PowerPoint Presentation Slides
 
Business Strategy Powerpoint Presentation Slides
Business Strategy Powerpoint Presentation SlidesBusiness Strategy Powerpoint Presentation Slides
Business Strategy Powerpoint Presentation Slides
 
Basic Pivot Features In Collabion Charts For SharePoint
Basic Pivot Features In Collabion Charts For SharePointBasic Pivot Features In Collabion Charts For SharePoint
Basic Pivot Features In Collabion Charts For SharePoint
 
Competitive Analysis Methods And Strategy PowerPoint Presentation Slides
Competitive Analysis Methods And Strategy PowerPoint Presentation SlidesCompetitive Analysis Methods And Strategy PowerPoint Presentation Slides
Competitive Analysis Methods And Strategy PowerPoint Presentation Slides
 
Game, set and perfect match. Wimbledon and IBM
Game, set and perfect match. Wimbledon and IBMGame, set and perfect match. Wimbledon and IBM
Game, set and perfect match. Wimbledon and IBM
 
Deck Design for Non Designers
Deck Design for Non DesignersDeck Design for Non Designers
Deck Design for Non Designers
 
Advertisement PowerPoint Presentation Slides
Advertisement PowerPoint Presentation SlidesAdvertisement PowerPoint Presentation Slides
Advertisement PowerPoint Presentation Slides
 
Microsoft Power BI
Microsoft Power BIMicrosoft Power BI
Microsoft Power BI
 
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...
Conférence Laboratoire des Mondes Virtuels_Dataiku_Choix technologiques pour ...
 
iSPORTiSTiCS investment opportunity 2020
iSPORTiSTiCS investment opportunity 2020iSPORTiSTiCS investment opportunity 2020
iSPORTiSTiCS investment opportunity 2020
 
Quo vadis Power BI?
Quo vadis Power BI?Quo vadis Power BI?
Quo vadis Power BI?
 
Competitive Landscape Module PowerPoint Presentation Slides
Competitive Landscape Module PowerPoint Presentation SlidesCompetitive Landscape Module PowerPoint Presentation Slides
Competitive Landscape Module PowerPoint Presentation Slides
 
Company Valuation Powerpoint Presentation Slides
Company Valuation Powerpoint Presentation SlidesCompany Valuation Powerpoint Presentation Slides
Company Valuation Powerpoint Presentation Slides
 

More from PowerSaturdayParis

Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre servicePower Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre servicePowerSaturdayParis
 
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power PlatformPower Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power PlatformPowerSaturdayParis
 
Power Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 securityPower Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 securityPowerSaturdayParis
 
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...PowerSaturdayParis
 
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...PowerSaturdayParis
 
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps formsPower Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps formsPowerSaturdayParis
 
Power Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPower Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPowerSaturdayParis
 
Power Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accountingPower Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accountingPowerSaturdayParis
 
Power Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practicesPower Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practicesPowerSaturdayParis
 
Power Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embeddedPower Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embeddedPowerSaturdayParis
 
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...PowerSaturdayParis
 
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoMLPower Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoMLPowerSaturdayParis
 
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big DataPower Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big DataPowerSaturdayParis
 
Power Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep divePower Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep divePowerSaturdayParis
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPowerSaturdayParis
 
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DBPower Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DBPowerSaturdayParis
 
Power Saturday 2019 B3 - SQL Server dans Azure
Power Saturday 2019 B3 - SQL Server dans AzurePower Saturday 2019 B3 - SQL Server dans Azure
Power Saturday 2019 B3 - SQL Server dans AzurePowerSaturdayParis
 
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...PowerSaturdayParis
 
Power Saturday 2019 A5 - Azure Machine Learning par l'exemple
Power Saturday 2019 A5 - Azure Machine Learning par l'exemplePower Saturday 2019 A5 - Azure Machine Learning par l'exemple
Power Saturday 2019 A5 - Azure Machine Learning par l'exemplePowerSaturdayParis
 
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...PowerSaturdayParis
 

More from PowerSaturdayParis (20)

Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre servicePower Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
 
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power PlatformPower Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
 
Power Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 securityPower Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 security
 
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
 
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
 
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps formsPower Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
 
Power Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPower Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplained
 
Power Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accountingPower Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accounting
 
Power Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practicesPower Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practices
 
Power Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embeddedPower Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embedded
 
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
 
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoMLPower Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
 
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big DataPower Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
 
Power Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep divePower Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep dive
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbook
 
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DBPower Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB
Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB
 
Power Saturday 2019 B3 - SQL Server dans Azure
Power Saturday 2019 B3 - SQL Server dans AzurePower Saturday 2019 B3 - SQL Server dans Azure
Power Saturday 2019 B3 - SQL Server dans Azure
 
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...
Power Saturday 2019 B2 - Running stateful(set) applications like SQL Server i...
 
Power Saturday 2019 A5 - Azure Machine Learning par l'exemple
Power Saturday 2019 A5 - Azure Machine Learning par l'exemplePower Saturday 2019 A5 - Azure Machine Learning par l'exemple
Power Saturday 2019 A5 - Azure Machine Learning par l'exemple
 
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...
Power Saturday 2019 B5 - Mise en place d'une architecture data dans Azure, re...
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX

  • 1. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 14 et 15 juin 2019, Paris Power Saturday
  • 2. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 3 communautés pour partager, échanger et apprendre Power BI, Data, IA, Power Platform, Office 365, SharePoint, etc.
  • 3. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Power Saturday CALCULATE() - the Swiss Army Knife in DAX Hans Peter Pfister
  • 4. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖Senior Consultant Business Intelligence, IT-Logix AG, Bern / Zurich ❖More than 25 years in Data Analytics & Reporting ❖Co-Leader Power BI PUG Switzerland ❖Power BI & Excel Speaker ❖LinkedIn Trainer, Blog Author ❖ Who I am….
  • 5. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Who are the participants? • BI / Reporting Professional? • Business User (Controlling / Finance, Marketing, others?) • Experience in DAX? - none, little, seasoned, Ninja (aka SQLBI)?
  • 6. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖ Introduction ❖ Evaluation Context – explore how DAX works ❖ Introducing CALCULATE() ❖ Working with Filter conditions from tables / columns: - Add & Update Filters - Ignore Filters ❖ Filtering with Measures ❖ Conclusion & Questions Agenda
  • 7. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 A Swiss Army Knife…
  • 8. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Evaluation Context - how DAX works F 1. Filter evaluation ("initial filter context") => Report Filter, Page Filter, Visual Filter, Slicers, Row Header, Column Header C 2. CALCULATE() ("explicit" filters) sets, updates or ignores filters R 3. Relationships propagate relations from dimensions to facts (in filter direction) A 4. Arithmetic calculating the result according to the formula (e.g. SUM) Filter Context https://www.powerbi-pro.com/en/how-dax-calculates-values/
  • 9. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 1. Initial Filter Context Page Filter Report Filter Visual Filters Filters from Slicer Row Headers Column Headers
  • 10. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 2. Calculate – explicit filter conditions ❖Sales = Sum(Sales[SalesAmount]) => In this example, there is no explicit filter set ❖Sales = CALCULATE ([Sales]; Products[Color] = "black") => explicit filter for products table is set ❖more later…..
  • 11. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Dimension Dimension Dimension Dimension Facts 3. Relationship «one side» «many side» Filter direction
  • 12. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 4. Doing the math ❖Sales = Sum(Sales[SalesAmount]) => e.g. summing up the surviving rows in the fact table ❖Sales = CALCULATE ([Sales]; Products[Color] = "black") => e.g. summing up the surviving rows in the fact table
  • 13. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖Corresponds approximately to the SUMIFS() function in Excel – but it is more powerful ❖The best friend of every DAX user ❖The only function that can change the initial filter context! Introducing CALCULATE()
  • 14. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Calculate Function https://dax.guide/calculate/ • The second set of arguments, i.e. the “Filter arguments,” are evaluated and applied first • Then the expression is evaluated under new “Filter Context"
  • 15. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖ If there is no existing filter context, a new filter is added by the filter parameter ❖ Otherwise, the filter parameter updates the existing filter context Two Rules of CALCULATE()
  • 17. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Adding - changed filter context Sales of Red items = CALCULATE( Sales[Sales]; Products[Color] = "Red") Products[Product Category] = “Accessories" Products[Product Category] = “Accessories" Date[CalendarYear] = 2012 Date[CalendarYear] = 2012 Products[Color] = "Red")
  • 19. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Updating - changed filter context Just Bikes: CALCULATE( Sales[Sales]; Products[ProductCategory] = “Bikes") Products[Product Category] = “Bikes" Date[CalendarYear] = 2012 Products[Product Category] = “Accessories" Date[CalendarYear] = 2012
  • 21. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Comparison options CALCULATE() expects filter conditions in the form of ❖ Table[column] = condition (e.g. products[color]="red") or similar ❖ To the left of the comparison operator (=, <, >, <=, >=, <>) a column from a table must be listed. ❖ No measure may be used to the right of the comparison operator either.
  • 22. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Comparison options with FILTER() The following comparison options are allowed with FILTER(): ❖ Table[Column] = [Measure] ❖ Table[Column] = Table[Column] ❖ [Measure] = [Measure2] ❖ AND: <TRUE/FALSE expression1> && < TRUE/FALSE expression2> ❖ OR: <true/FALSE expression1> || <true/FALSE expression2>
  • 24. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖DAX Studio https://daxstudio.org/ Useful tools
  • 25. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 ❖CALCULATE() is a mighty weapon ❖Always take a look at the filter context ❖use DAX Studio or a calculated table if you get stuck Take Aways
  • 26. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Hans Peter Pfister h.p.pfister@powerbi-pro.com www.powerbi-pro.com @hp_pfister www.linkedin.com/in/hans-peter-pfister Contact me!
  • 27. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Evaluations
  • 28. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 Merci à nos sponsors http:// PowerSaturday.com Silver Bronze Gold
  • 29. @ClubPowerBI @aosComm @GUSS_FRANCEPower Saturday 2019 The European SharePoint, Office 365 & Azure Conference 4 Days 2,500 Delegates 150+ Sessions 120 Speakers Use code ESPC19SPSP for 10% discount on all tickets www.sharepointeurope.com