0% found this document useful (0 votes)
3 views

Chapter 1

The document provides an introduction to DAX (Data Analysis eXpressions) in Power BI, explaining its purpose as a formula language for creating calculations such as columns, tables, and measures. It details various DAX functions, including aggregation, date and time, logical, and text functions, along with examples of creating calculated columns and measures. The document emphasizes the differences between calculated columns, which evaluate at the row level, and calculated measures, which aggregate multiple rows and are calculated at query time.

Uploaded by

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

Chapter 1

The document provides an introduction to DAX (Data Analysis eXpressions) in Power BI, explaining its purpose as a formula language for creating calculations such as columns, tables, and measures. It details various DAX functions, including aggregation, date and time, logical, and text functions, along with examples of creating calculated columns and measures. The document emphasizes the differences between calculated columns, which evaluate at the row level, and calculated measures, which aggregate multiple rows and are calculated at query time.

Uploaded by

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

Introduction to DAX

in Power BI
I N T R O D U C T I O N TO DA X I N POW E R B I

Jess Ahmet
Content Developer, DataCamp
What is DAX?
Data Analysis eXpressions
Formula language to create calculations
Columns, tables, measures

Based on Excel formulas and functions


e.g., SUM()

Used in other Microsoft tools


Power Pivot and Analysis Services

INTRODUCTION TO DAX IN POWER BI


DAX functions
Predefined formulas that perform calculations on specific values called arguments

Function syntax indicates the order of arguments expected

Function categories
Aggregation - SUM() , AVERAGE() , COUNT()

Date and Time - TODAY() , MONTH() , YEAR()

Logical - IF() , AND() , OR()

Text - CONCATENATE() , UPPER() , LEFT()

And many more...

DAX reference:
https://docs.microsoft.com/en-us/dax/dax-function-reference

INTRODUCTION TO DAX IN POWER BI


DAX functions example
SUM() LEFT()
Syntax: SUM(<column>) Syntax: LEFT(<text>, <num_chars>)
Description: Adds all the numbers in a Description: Returns the specified
column. number of characters from the start of a
text.
One argument: <column>
Example: SUM(Sales) Two arguments: <text> , <num_chars>
Example: LEFT('DataCamp', 4) = "Data"

INTRODUCTION TO DAX IN POWER BI


Creating calculated columns
Expands our existing datasets without editing the source data

Evaluates at a row level and adds a new column to an existing table

Calculated at data load or when the data is refreshed

INTRODUCTION TO DAX IN POWER BI


Creating calculated columns
Expands our existing datasets without editing the source
Evaluates at a row level and adds a new column to an existing table

Calculated at data load and when the data is refreshed

DAX example: Price_w_tax = Price + ( Price * Tax )

Item Price Tax


A $ 20 25%
B $ 45 0%
C $ 100 15%

INTRODUCTION TO DAX IN POWER BI


Creating calculated columns
Expands our existing datasets without editing the source
Evaluates at a row level and adds a new column to an existing table

Calculated at data load and when the data is refreshed

DAX example: Price_w_tax = Price + ( Price * Tax )

Item Price Tax Price_w_tax


A $ 20 25% $25
B $ 45 0% $45
C $ 100 15% $115

INTRODUCTION TO DAX IN POWER BI


Creating calculated measures
Enables complex calculations
Aggregates multiple rows and adds a new field that can be added to visualizations

Calculated at query time as you interact and filter


More efficient because the calculation is not run every time the table is accessed

Two ways to create a measure


Write a measure from scratch

Use the built-in Quick Measure tool

INTRODUCTION TO DAX IN POWER BI


Creating calculated measures
Item Price Tax Price_w_tax
A $ 20 25% $25
B $ 45 0% $45
C $ 100 15% $115
Total_price_w_tax = SUM(Price_w_tax)

Total_price_w_tax = $25 + $45 + $115 = $185

INTRODUCTION TO DAX IN POWER BI


Summary
Calculated columns: Calculated measures:
Evaluate for each row

Add a new column to an existing table

Calculated at data load or when the data is


refreshed

INTRODUCTION TO DAX IN POWER BI


Summary
Calculated columns: Calculated measures:
For evaluating each row For aggregating multiple rows

Add a new column to an existing table Results in another field that you can add to
a visualization
Calculated at data load or when the data is
refreshed Calculated at query time as you interact
and filter
Item Price Tax Price_w_tax
Total_price_w_tax = SUM(Price_w_tax)
A $ 20 25% $25
B $ 45 0% $45
C $ 100 15% $115

INTRODUCTION TO DAX IN POWER BI


Summary
Calculated columns: Calculated measures:
For evaluating each row For aggregating multiple rows

Add a new column to an existing table Results in another field that you can add to
a visualization
Calculated at data load and when the data
is refreshed Calculated at query time as you interact
and filter
Item Price Tax Price_w_tax
Total_price_w_tax = SUM(Price_w_tax)
A $ 20 25% $25
B $ 45 0% $45
C $ 100 15% $115

1 Calculated tables will be covered later.

INTRODUCTION TO DAX IN POWER BI


Adventure Works
Sells bikes and bike-parts globally
Table: Sales
Transactional data for each order line of
a sale

Contains categorical data including


product category

INTRODUCTION TO DAX IN POWER BI


Let's practice!
I N T R O D U C T I O N TO DA X I N POW E R B I
Creating calculated
columns and
measures
I N T R O D U C T I O N TO DA X I N POW E R B I

Jess Ahmet
Content Developer, DataCamp
Let's practice!
I N T R O D U C T I O N TO DA X I N POW E R B I

You might also like