What is DAX
DAX is the abbreviated form of Data Analytics Expressions. It means that it is a type
of formulae or expressions that are used for the analysis and calculations of data. The
combination or collection of different expressions such as constants, operators, and
functions form a formula to give results or output. To check the list of examples check
Power BI DAX functions with examples pdf.
Need of DAX in Power BI
In Power BI, we can read data from the database. The table can also be merged in
Power BI. It is seen that the data from columns are readily available for plotting but it
is not possible that the data will always be available in the same way.
Suppose we want to improve our dashboard and for that, we need to change or modify
our data. . Consider a situation that in Power BI the modifications that data we require
are not readily available. It is simple we will have to perform some modifications to
the available data. Thus, to help perform this kind of modification on the data Power
BI DAX function comes into the picture.
Power BI DAX function helps in finding more detailed information from raw data.
Long things cut short is Data Manipulation is done with the help of DAX. Analysts
can come up with fresh insights by discovering new ways of data calculation with the
help of DAX. A smart and intelligent approach is provided to the data analysis in
Power BI by using DAX.
Key points about DAX
• A DAX function that can be executed may contain value references, nested
functions, conditional statements, etc. The complete code of DAX will always
be a function.
• Numeric and Non-Numeric or others are the two primary data types in DAX
formulae. Currency, decimals, integers, etc. come under a numeric data type.
Whereas, binary objects and strings come under non-numeric data type.
• The procedure of evaluating a DAX function is that the evaluation starts from
inside to outside. This makes the DAX formulating important.
Mixed datatype values can be used as inputs to the Power BI DAX formula,
conversion of theses values takes place at the time of execution automatically. To
understand the conversion of DAX formula goes to Power BI DAX functions with
examples pdf. The output of the DAX formula will be in the datatype you instructed.
Getting started with Power BI DAX
To understand the usage and importance of DAX in detail and how exactly it is
helpful in Power BI, let us take an example to understand it fully.
Let us assume that we want to make a visual in Power BI that will analyze the
percentage of growth across all states in a country or want to compare growth/sales
yearly. For this kind of calculation, the data is not sufficient that are imported in data
tables. We have to perform some operations on the data to make it in a usable form.
This work is done by using the Power BI DAX function.
1. Syntax of Power BI DAX Formula
Any language can be learned in the best way by understanding its elements
after splitting them. Thus, before studying any language we study its syntax
first. The following is the DAX formula. Let us understand its syntax through
its elements.
1. TotalSales defines the name of the new measure.
2. = (equals to sign) is an operator equating two sides and starting of DAX
formula.
3. SUM is the DAX function.
4. Parenthesis() is used to define arguments and enclose it in the service.
Every formula should have at least one argument compulsorily. Sheet1 is the
name of the table. [Gross Sales Amt] is the name of the field. The function
will apply itself in the areas of the table name mentioned. .
Thus, this Power BI DAX formula finds the sum of the product of Gross sales
Amount of three years of total sales data.
Note: D is used to represent that this formula is DAX related formula for our
understanding.
2. Calculation Types of DAX
Formulas in DAX can also be called calculations because ultimately, they are
performing calculations to give a resultant value that can be used. Calculated
Columns and Calculated Measures are the two calculations that are mainly
performed via DAX in Power BI.
A. Calculated Columns
A new column is created in the existing table by Calculated Columns. At
least one function is there in the calculated column rather than the regular
one. Whenever you want a column with sorted or filtered information, these
calculated columns are used.
Steps to create a Calculated Column:
• Step 1: Click on the Modelling tab in Power BI and select New Option.
• Step 2: A formula bar will open. In that, you can replace the Column
word in it by the name of your column.
• Step 3: Enter the equation to the right-hand side of the equals to sign.
B. Calculate Measures
Calculated measures will create a field having aggregated values such as
averages, percentages, ratios, sum, etc.
Steps to create a Calculated Measures:
• Step 1: Click on the Modelling tab in Power BI and select the New
Measure tab.
• Step 2: A formula bar will open. In that, you can replace the Measure
word in it by the name you want.
• Step 3: The expression which needs to be calculated can be entered on
the right side of the equals to sign.
• Step 4: The measure name can be modified by the calculator icon (?)
next to it.
1. Syntax of Power BI DAX Formula
Any language can be learned in the best way by understanding its elements
after splitting them. Thus, before studying any language we study its syntax
first. The following is the DAX formula. Let us understand its syntax through
its elements.
1. TotalSales defines the name of the new measure.
2. = (equals to sign) is an operator equating two sides and starting of DAX
formula.
3. SUM is the DAX function.
4. Parenthesis() is used to define arguments and enclose it in the service.
Every formula should have at least one argument compulsorily. Sheet1 is the
name of the table. [Gross Sales Amt] is the name of the field. The function
will apply itself in the areas of the table name mentioned. To understand the
syntax more clearly read the Power BI DAX functions with examples pdf.
Thus, this Power BI DAX formula finds the sum of the product of Gross sales
Amount of three years of total sales data.
Note: D is used to represent that this formula is DAX related formula for our
understanding.
2. Calculation Types of DAX
Formulas in DAX can also be called calculations because ultimately, they are
performing calculations to give a resultant value that can be used. Calculated
Columns and Calculated Measures are the two calculations that are mainly
performed via DAX in Power BI.
A. Calculated Columns
A new column is created in the existing table by Calculated Columns. At
least one function is there in the calculated column rather than the regular
one. Whenever you want a column with sorted or filtered information, these
calculated columns are used.
Steps to create a Calculated Column:
• Step 1: Click on the Modelling tab in Power BI and select New Option.
• Step 2: A formula bar will open. In that, you can replace the Column
word in it by the name of your column.
• Step 3: Enter the equation to the right-hand side of the equals to sign.
B. Calculate Measures
Calculated measures will create a field having aggregated values such as
averages, percentages, ratios, sum, etc.
Steps to create a Calculated Measures:
• Step 1: Click on the Modelling tab in Power BI and select the New
Measure tab.
• Step 2: A formula bar will open. In that, you can replace the Measure
word in it by the name you want.
• Step 3: The expression which needs to be calculated can be entered on
the right side of the equals to sign.
• Step 4: The measure name can be modified by the calculator icon (?)
next to it.