0% found this document useful (0 votes)
51 views20 pages

Introduction To Data Analysis Expressions (DAX)

Very well defined

Uploaded by

rupamgupta963
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views20 pages

Introduction To Data Analysis Expressions (DAX)

Very well defined

Uploaded by

rupamgupta963
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Introduction to

Data Analysis Expressions


(DAX)
What is DAX?

• DAX (Data Analysis Expressions)


is a formula language used in
Power BI, Excel Power Pivot, and
SQL Server Analysis Services. It
is used to Calculated
Columns/Tables and Measures in
Power BI reports.
Calculated Columns

Definition:
A calculated column is created at the row level within a table and is stored in the model.
Example:
Total Cost = Sales[Quantity] * Sales[Price]
Use Case:
Used when new data needs to be available for filtering, sorting, or categorization
Measures

Definition:
Measures are dynamic calculations performed at runtime when used in a visual.
Example:
Total Sales = SUM(Sales[Amount])
Use Case:
Measures are more efficient than calculated columns because they do not store
extra data in the model.
Calculated Columns vs Measures

Calculated
Feature Measure
Column
Calculated on
Storage Stored in the table
demand
Performanc Increases model
More efficient
e size
Used for
Useful for row-level
Use Cases aggregations in
calculations
Implicit vs Explicit Measures

• Implicit Measures: Auto-generated by


Power BI (e.g., SUM, AVERAGE when
dragging fields into visuals).
• Explicit Measures: Created using DAX
for precise calculations.

Implicit
Measures

Explicit
Measures
DAX Syntax •A DAX formula consists of:
•Function Name: SUM(), FILTER()
Overview •Arguments: Inside parentheses
(Table[Column])
•Operators: +, -, *, /, &&, ||
Operators in DAX
Dax Operators are keywords or symbols used inside dax to specify certain
operations.

Types of Dax Operators are as below:


Arithmetic Comparison Logical
Operators: Operators: Operators:

Operat Operator Function Operator Function


Function
or
= Equal to && And
+ Addition
<> Not equal to || Or
- Subtraction
> Greater than
* Multiplication
< Less than
/ Division
Types of Dax
Functions
• Date
• Aggregate functions
DAX • Filter
Function • Logical
s • Text
• Time Intelligence
Date
Function
s:
Aggregate Functions:
Filter
Context in Definition:

DAX • Filter context refers to the set of filters


applied to data before a DAX formula is
evaluated. It determines which subset of data
is visible when performing calculations.
Row
Context in • Definition:
Row context is the context in which a DAX
DAX formula is evaluated for each row
individually in a table. It applies when a
calculation iterates over a table, processing one
row at a time.
Iterator Functions:

Iterator functions enable row-by-row calculations, allowing you to perform calculations


based on values in each row of a table. Types of Iterator functions:

• SUMX()
• AVERAGEX()
• MINX()
• MAXX()
• RANKX()
SUMX()

Definition:
The SUMX() function evaluates an expression for each row in a table and returns the
sum of the results.
📌 Syntax:
DAX
SUMX(<table>, <expression>)
📌 Example:
DAX
Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
🔹 Use Case: Compute total revenue by multiplying quantity and price for each row before
summing.
AVERAGEX()

Definition:
The AVERAGEX() function returns the average of an expression evaluated for
each row in a table.
📌 Syntax:
DAX
AVERAGEX(<table>, <expression>)
📌 Example:
DAX
Avg Revenue Per Order = AVERAGEX(Sales, Sales[Quantity] * Sales[UnitPrice])
🔹 Use Case: Compute the average revenue per transaction.
MINX()

Definition:
The MINX() function returns the smallest result of an expression evaluated
for each row in a table.
📌 Syntax:
DAX
MINX(<table>, <expression>)
📌 Example:
DAX
Min Revenue Per Order = MINX(Sales, Sales[Quantity] * Sales[UnitPrice])
🔹 Use Case: Find the minimum revenue per order.
MAXX()

Definition:
The MAXX() function returns the largest result of an expression evaluated
for each row in a table.
📌 Syntax:
DAX
MAXX(<table>, <expression>)
📌 Example:
DAX
Max Revenue Per Order = MAXX(Sales, Sales[Quantity] * Sales[UnitPrice])
🔹 Use Case: Find the highest revenue per order.
RANKX()

Definition:
The RANKX() function returns the ranking of a number within a column.
📌 Syntax:
DAX
RANKX(<table>, <expression>, <value>, <order>, <ties>)
📌 Example:
DAX
Sales Rank = RANKX(ALL(Sales), Sales[Amount], , DESC, DENSE)
🔹 Use Case: Rank products based on total sales.
Thank you!

You might also like