DAX
What is DAX?
DAX stands for Data Analysis Expressions. Expressions or formulas that are used for data
analysis and calculations.
The DAX language was created specifically for the handling of data models, through the use
of formulas and expressions.
DAX is a functional language i.e.; DAX formulas have two primary data types; Numeric and
Non-numeric or Others. The numeric data type includes integers, decimals, currency, etc.
Whereas, the non-numeric consists of strings and binary objects.
Note: DAX is not a programming language. It is primarily a formula language and is also a query
language.
Where Dax used?
DAX is used in several Microsoft Products
1. Power BI
2. Power Pivot for excel
3. SSAS Tabular Model
4. Azure Analysis Services
Importance of DAX in Power BI?
DAX can be used to create calculated columns or calculated measures in Power BI Desktop
Suppose if you need to analyze growth percentage across product categories and for
different date ranges? Or, you need to calculate year-over-year growth compared to market
trends?
DAX Scenarios?
DAX being a formula language meant for data analysis, you need to understand the various
scenarios where it can be used.
DAX Scenarios
Scenarios - Performing Complex Calculations
Scenarios - Working with Text and Dates
Scenarios - Conditional Values and Testing for Errors
Scenarios - Using Time Intelligence
Scenarios - Ranking and Comparing Values
What is difference between Measure and calculated filed?
Calculated Fields:
o Expands table by creating new table.
o Stored within table consumes RAM
o They continuously run calculations within the table itself.
Measures:
o Measures enable the user to create fields with aggregate values like average, ratio,
percentage, etc.
o Summarize Data in single value
o Templary stored in CPU
Types Of Power BI DAX Functions?
Types Of Power BI DAX Functions
1. Mathematical Functions:
o Operates on different mathematical and trigonometric functions and returns
relevant values, as needed.
2. Relationship Functions:
o Returns a value from another related table and offers a relationship between
different expressions in a single table or different ones.
3. Statistical Functions:
o Offers statistical functions that undergo aggregations. Possible to create
aggregations based on relevant information from tables like minimum, maximum,
sum, average, etc.
4. Financial Functions:
o Performs financial calculations like rate of return, net present value, etc.
5. Information Functions:
o Offers a comparison between the input value and if the value is correct or not,
returning the relevant response.
6. Logical Functions:
o Offers information about values in an expression based on its logical output.
7. Date And Time Functions: 70%
o These are typical date and time functions that are based on the DateTime data type.
8. Filter Functions:
o They return specified data types, lookup values in different tables, and filter through
related values.
9. Text Functions:
o Provides a set of functions that can return a part of the string, concatenate values
from the string, control functions for date and time formats, and search for text in a
string.
10. Time Intelligence Functions:
o Lets users build meaningful comparisons and create calculations that leverage the
in-built knowledge about dates and calendars.
11. Table Manipulation Functions:
o These functions either manipulate current tables or return a table, by adding
calculated columns to necessary tables.
Few Limitations
Note: DAX has many possible functions, and it can be hard to know where to start. Focus on the
basic functions first:
SUM, AVERAGE, MIN, MAX
COUNT, COUNTROWS
CALCULATE
FILTER
IF