DAX.pdf

Data Analysis Expressions drive all the calculations you can perform in Power BI. DAX formulas are versatile, dynamic, and very powerful – they allow you to create new fields and even new tables in your model. While DAX is most commonly associated with Power BI, you can also find DAX formulas in Power Pivot in Excel and SQL Server Analysis Services (SSAS).

What is DAX?
DAX or Data Analysis Expressions drive all the calculations you can perform in
Power BI. DAX formulas are versatile, dynamic, and very powerful – they allow you
to create new fields and even new tables in your model. While DAX is most
commonly associated with Power BI, you can also find DAX formulas in Power Pivot
in Excel and SQL Server Analysis Services (SSAS).
DAX formulas are made up of 3 core components and this tutorial will cover each of
these:
 Syntax – Proper DAX syntax is made up of a variety of elements, some of
which are common to all formulas.
 Functions – DAX functions are predefined formulas that take some
parameters and perform a specific calculation.
 Context – DAX uses context to determine which rows should be used to
perform a calculation.
Why is DAX Important in Power BI?
DAX formulas allow you to get the most out of your data and Power BI in
order to solve business problems efficiently. You can perform simple
calculations (such as a simple sum or average) and create most visuals
without even touching DAX. For example, if you wanted to create a
simple chart showing total profit you could simply drag the profit field
onto the Values section of the chart, and it would perform a sum of the
rows in that field.
There are two cases where it would be better to create a DAX formula:
1. If you wanted to re-use a formula in multiple places, such as in
multiple charts or as an expression in other DAX formulas. In this case,
using a DAX formula would make your report more efficient and easier
to change in the future since you would only need to change a single
formula rather than changing many individual formulas in each place
they are used.
2. If you wanted to create complex or customized formulas where just
a simple SUM or AVERAGE would not be sufficient for the business
problem you were trying to solve.
Where are DAX Formulas Used in Power BI?
There are three ways you can use DAX formulas in Power BI:
1. Calculated Tables - These calculations will add an additional table
to the report based on a formula.
2. Calculated Columns - These calculations will add an additional
column to a table based on a formula. These columns are treated like any
other field in the table.
3. Measures - These calculations will add a summary or aggregated
measure to a table based on a formula.
The main difference between these three types of calculations is in their
context (more on this later) and the outputs they produce.
To add any one of these types of calculations to a model, navigate to the
Modeling tab of the ribbon. Here you will find three choices for adding
either a new measure, calculated column, or table. Alternatively, you can
right-click a table in the Fields pane, and you will get the option to add a
new measure or calculated column in the drop-down menu.
How to Write a DAX Formula
DAX formulas are intuitive and easy to read. This makes it easy to
understand the basics of DAX so you can start writing your own formulas
relatively quickly. Let’s go over the building blocks of proper DAX syntax.
1. The name of the measure or calculated column
2. The equal-to operator (“=”) indicates the start of the formula
3. A DAX function
4. Opening (and closing) parentheses (“()”)
5. Column and/or table references
6. Note that each subsequent parameter in a function is separated by
a comma (“,”)DAX functions can also be nested inside each other to
perform multiple operations efficiently. This can save a lot of time when
writing DAX formulas. For example, it is often useful to have multiple
nested IF statements or to use the IFERROR function to wrap around
another function, so that any errors in the formula are represented by
the value you specify.
Some of the most common DAX functions used in reports are:
1. Simple calculations: COUNT, DISTINCTCOUNT, SUM, AVERAGE,
MIN, MAX.
2. SUMMARISE: Returns a table typically used to further apply
aggregations over different groupings.
3. CALCULATE: Performs an aggregation along with one or more
filters. When you specify more than one filter, the function will perform
the calculation where all filters are true.
4. IF: Based on a logical condition, it will return a different value for
if it is true or false. This is similar to the CASE WHEN operation in SQL.
5. IFERROR: Looks for any errors for an inner function and returns a
specified result
6. ISBLANK: Checks if the rows in a column are blank and returns
true or false. Useful to use in conjunction with other functions like IF.
7. EOMONTH: Returns the last day of the month of a given date
(column reference in a date format) for as many months in the past or
the future.
8. DATEDIFF: returns the difference between 2 dates (both as column
references in date formats) in days, months, quarters, years, etc.

Recomendados

Quick start learn dax basics in 30 minutes por
Quick start   learn dax basics in 30 minutesQuick start   learn dax basics in 30 minutes
Quick start learn dax basics in 30 minutesКомпания Робот Икс
1.9K vistas16 diapositivas
Funções DAX.pdf por
Funções DAX.pdfFunções DAX.pdf
Funções DAX.pdfJoao Vaz
21 vistas705 diapositivas
E-Book 25 Tips and Tricks MS Excel Functions & Formulaes por
E-Book 25 Tips and Tricks MS Excel Functions & FormulaesE-Book 25 Tips and Tricks MS Excel Functions & Formulaes
E-Book 25 Tips and Tricks MS Excel Functions & FormulaesBurCom Consulting Ltd.
24.1K vistas58 diapositivas
Dax best practices.pdf por
Dax best practices.pdfDax best practices.pdf
Dax best practices.pdfdeepneuron
241 vistas6 diapositivas
Microsoft Excel | Master Excel | Advance Excel | Excel por
Microsoft Excel | Master Excel | Advance Excel | Excel Microsoft Excel | Master Excel | Advance Excel | Excel
Microsoft Excel | Master Excel | Advance Excel | Excel devbhargav1
8 vistas11 diapositivas
CheatSheet_DAX_EN.pdf por
CheatSheet_DAX_EN.pdfCheatSheet_DAX_EN.pdf
CheatSheet_DAX_EN.pdfKenz31
87 vistas1 diapositiva

Más contenido relacionado

Similar a DAX.pdf

Microsoft Excel | Master Excel | Advance Excel | Excel por
Microsoft Excel | Master Excel | Advance Excel | Excel Microsoft Excel | Master Excel | Advance Excel | Excel
Microsoft Excel | Master Excel | Advance Excel | Excel devbhargav1
5 vistas8 diapositivas
Microsoft Excel Training por
Microsoft Excel TrainingMicrosoft Excel Training
Microsoft Excel TrainingHudaRaghibKadhim
527 vistas78 diapositivas
Excel Tips por
Excel TipsExcel Tips
Excel TipsSpicy Flavours
746 vistas55 diapositivas
Excel Tips por
Excel TipsExcel Tips
Excel TipsKritika
463 vistas54 diapositivas
Microsoft Excel Tips por
Microsoft Excel TipsMicrosoft Excel Tips
Microsoft Excel Tipsmifarooqui
706 vistas54 diapositivas
Excel Tips por
Excel TipsExcel Tips
Excel Tipskktv
769 vistas54 diapositivas

Similar a DAX.pdf(20)

Microsoft Excel | Master Excel | Advance Excel | Excel por devbhargav1
Microsoft Excel | Master Excel | Advance Excel | Excel Microsoft Excel | Master Excel | Advance Excel | Excel
Microsoft Excel | Master Excel | Advance Excel | Excel
devbhargav15 vistas
Excel Tips por Kritika
Excel TipsExcel Tips
Excel Tips
Kritika463 vistas
Microsoft Excel Tips por mifarooqui
Microsoft Excel TipsMicrosoft Excel Tips
Microsoft Excel Tips
mifarooqui706 vistas
Excel Tips por kktv
Excel TipsExcel Tips
Excel Tips
kktv769 vistas
LESSON-4-HOW-DO-I-USE-ADVANCED-EXCEL-TOOLS-TO-PROCESS-AND-PRESENTDATA.pptx por marybethgrabillo1
LESSON-4-HOW-DO-I-USE-ADVANCED-EXCEL-TOOLS-TO-PROCESS-AND-PRESENTDATA.pptxLESSON-4-HOW-DO-I-USE-ADVANCED-EXCEL-TOOLS-TO-PROCESS-AND-PRESENTDATA.pptx
LESSON-4-HOW-DO-I-USE-ADVANCED-EXCEL-TOOLS-TO-PROCESS-AND-PRESENTDATA.pptx
marybethgrabillo123 vistas
Excel Useful Tips por Parul_100in
Excel Useful TipsExcel Useful Tips
Excel Useful Tips
Parul_100in827 vistas
Excel useful tips por Mohsin Azad
Excel useful tipsExcel useful tips
Excel useful tips
Mohsin Azad527 vistas

Más de Satishkumar722293

TARGET AUDIENCE.pdf por
TARGET AUDIENCE.pdfTARGET AUDIENCE.pdf
TARGET AUDIENCE.pdfSatishkumar722293
4 vistas3 diapositivas
CAREER DEVELOPMENT.pdf por
CAREER DEVELOPMENT.pdfCAREER DEVELOPMENT.pdf
CAREER DEVELOPMENT.pdfSatishkumar722293
4 vistas3 diapositivas
DAX.pdf por
DAX.pdfDAX.pdf
DAX.pdfSatishkumar722293
6 vistas3 diapositivas
WHAT IS JVM.pdf por
WHAT IS JVM.pdfWHAT IS JVM.pdf
WHAT IS JVM.pdfSatishkumar722293
3 vistas3 diapositivas
Data Science.pdf por
Data Science.pdfData Science.pdf
Data Science.pdfSatishkumar722293
6 vistas5 diapositivas
JAVA SCRIPT.pdf por
JAVA SCRIPT.pdfJAVA SCRIPT.pdf
JAVA SCRIPT.pdfSatishkumar722293
3 vistas3 diapositivas

Más de Satishkumar722293(20)

Último

IIBA Adelaide Lean Coffee - FOBA & other Acronyms por
IIBA Adelaide Lean Coffee - FOBA & other AcronymsIIBA Adelaide Lean Coffee - FOBA & other Acronyms
IIBA Adelaide Lean Coffee - FOBA & other AcronymsAustraliaChapterIIBA
20 vistas11 diapositivas
1123.CV-02.pdf por
1123.CV-02.pdf1123.CV-02.pdf
1123.CV-02.pdfThomas GIRARD BDes
46 vistas18 diapositivas
113. BP International por
113. BP International113. BP International
113. BP InternationalManu Mitra
9 vistas1 diapositiva
Service Public.pdf por
Service Public.pdfService Public.pdf
Service Public.pdflatifaeid87
9 vistas5 diapositivas
Part 6.pptx por
Part 6.pptxPart 6.pptx
Part 6.pptxSheldon Byron
6 vistas34 diapositivas
Resumes, Cover Letters, and Applying Online por
Resumes, Cover Letters, and Applying Online Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online Bruce Bennett
16 vistas89 diapositivas

Último(20)

113. BP International por Manu Mitra
113. BP International113. BP International
113. BP International
Manu Mitra9 vistas
Resumes, Cover Letters, and Applying Online por Bruce Bennett
Resumes, Cover Letters, and Applying Online Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
Bruce Bennett16 vistas
Navigating Towards Safer Roads Addressing Traffic Accidents in the UAE (2).pdf por alyazyaalmulla11
Navigating Towards Safer Roads Addressing Traffic Accidents in the UAE (2).pdfNavigating Towards Safer Roads Addressing Traffic Accidents in the UAE (2).pdf
Navigating Towards Safer Roads Addressing Traffic Accidents in the UAE (2).pdf
alyazyaalmulla115 vistas
ACF2024 - HENNGE por AyakaIto2
ACF2024 - HENNGEACF2024 - HENNGE
ACF2024 - HENNGE
AyakaIto268 vistas
Empowerment technology por syrahtango81
Empowerment technology Empowerment technology
Empowerment technology
syrahtango817 vistas
Bias in chess por hr7l1234
Bias in chessBias in chess
Bias in chess
hr7l12345 vistas
Topic 36.pptx por saleh176
Topic 36.pptxTopic 36.pptx
Topic 36.pptx
saleh1767 vistas
FAMILY COMMUNICATION.pdf por shai5a3ssa
FAMILY COMMUNICATION.pdfFAMILY COMMUNICATION.pdf
FAMILY COMMUNICATION.pdf
shai5a3ssa10 vistas
ACF2024 - TOMATO INC por AyakaIto2
ACF2024 - TOMATO INCACF2024 - TOMATO INC
ACF2024 - TOMATO INC
AyakaIto244 vistas
WATSON WS_DONATE LIFE TN_MUSIC CITY ROOTS INSERT (2).pdf por WriteNashvegas
WATSON WS_DONATE LIFE TN_MUSIC CITY ROOTS INSERT (2).pdfWATSON WS_DONATE LIFE TN_MUSIC CITY ROOTS INSERT (2).pdf
WATSON WS_DONATE LIFE TN_MUSIC CITY ROOTS INSERT (2).pdf
WriteNashvegas5 vistas
24. Data Processing por Manu Mitra
24. Data Processing 24. Data Processing
24. Data Processing
Manu Mitra6 vistas

DAX.pdf

  • 1. What is DAX? DAX or Data Analysis Expressions drive all the calculations you can perform in Power BI. DAX formulas are versatile, dynamic, and very powerful – they allow you to create new fields and even new tables in your model. While DAX is most commonly associated with Power BI, you can also find DAX formulas in Power Pivot in Excel and SQL Server Analysis Services (SSAS). DAX formulas are made up of 3 core components and this tutorial will cover each of these:  Syntax – Proper DAX syntax is made up of a variety of elements, some of which are common to all formulas.  Functions – DAX functions are predefined formulas that take some parameters and perform a specific calculation.  Context – DAX uses context to determine which rows should be used to perform a calculation. Why is DAX Important in Power BI? DAX formulas allow you to get the most out of your data and Power BI in order to solve business problems efficiently. You can perform simple calculations (such as a simple sum or average) and create most visuals without even touching DAX. For example, if you wanted to create a simple chart showing total profit you could simply drag the profit field onto the Values section of the chart, and it would perform a sum of the rows in that field. There are two cases where it would be better to create a DAX formula: 1. If you wanted to re-use a formula in multiple places, such as in multiple charts or as an expression in other DAX formulas. In this case, using a DAX formula would make your report more efficient and easier to change in the future since you would only need to change a single formula rather than changing many individual formulas in each place they are used. 2. If you wanted to create complex or customized formulas where just a simple SUM or AVERAGE would not be sufficient for the business problem you were trying to solve.
  • 2. Where are DAX Formulas Used in Power BI? There are three ways you can use DAX formulas in Power BI: 1. Calculated Tables - These calculations will add an additional table to the report based on a formula. 2. Calculated Columns - These calculations will add an additional column to a table based on a formula. These columns are treated like any other field in the table. 3. Measures - These calculations will add a summary or aggregated measure to a table based on a formula. The main difference between these three types of calculations is in their context (more on this later) and the outputs they produce. To add any one of these types of calculations to a model, navigate to the Modeling tab of the ribbon. Here you will find three choices for adding either a new measure, calculated column, or table. Alternatively, you can right-click a table in the Fields pane, and you will get the option to add a new measure or calculated column in the drop-down menu. How to Write a DAX Formula DAX formulas are intuitive and easy to read. This makes it easy to understand the basics of DAX so you can start writing your own formulas relatively quickly. Let’s go over the building blocks of proper DAX syntax. 1. The name of the measure or calculated column 2. The equal-to operator (“=”) indicates the start of the formula 3. A DAX function 4. Opening (and closing) parentheses (“()”) 5. Column and/or table references 6. Note that each subsequent parameter in a function is separated by a comma (“,”)DAX functions can also be nested inside each other to
  • 3. perform multiple operations efficiently. This can save a lot of time when writing DAX formulas. For example, it is often useful to have multiple nested IF statements or to use the IFERROR function to wrap around another function, so that any errors in the formula are represented by the value you specify. Some of the most common DAX functions used in reports are: 1. Simple calculations: COUNT, DISTINCTCOUNT, SUM, AVERAGE, MIN, MAX. 2. SUMMARISE: Returns a table typically used to further apply aggregations over different groupings. 3. CALCULATE: Performs an aggregation along with one or more filters. When you specify more than one filter, the function will perform the calculation where all filters are true. 4. IF: Based on a logical condition, it will return a different value for if it is true or false. This is similar to the CASE WHEN operation in SQL. 5. IFERROR: Looks for any errors for an inner function and returns a specified result 6. ISBLANK: Checks if the rows in a column are blank and returns true or false. Useful to use in conjunction with other functions like IF. 7. EOMONTH: Returns the last day of the month of a given date (column reference in a date format) for as many months in the past or the future. 8. DATEDIFF: returns the difference between 2 dates (both as column references in date formats) in days, months, quarters, years, etc.