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

Lab_4___Data_Analysis_Expressions

Lab 4 focuses on Data Analysis Expressions (DAX) and requires completion of previous labs and data model setup. The objectives include creating calculated columns and measures in Power BI, such as Quantity Sold and Return Rate, while emphasizing the importance of filter context. Additionally, the lab encourages best practices by suggesting the creation of a dedicated table for measures to maintain organization.

Uploaded by

nhitb312.nevents
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)
7 views

Lab_4___Data_Analysis_Expressions

Lab 4 focuses on Data Analysis Expressions (DAX) and requires completion of previous labs and data model setup. The objectives include creating calculated columns and measures in Power BI, such as Quantity Sold and Return Rate, while emphasizing the importance of filter context. Additionally, the lab encourages best practices by suggesting the creation of a dedicated table for measures to maintain organization.

Uploaded by

nhitb312.nevents
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/ 2

Lab 4: Data Analysis Expressions (DAX), Part 1

Dr Huan Vu

Business AI Lab

Faculty of Data Science and Artificial Intelligence


College of Technology
National Economics University, Vietnam
Email: [email protected]

1
Faculty of Data Science and Artificial Intelligence, NEU

Prerequisites
To be able to complete this Lab, you should have finished Lab 2 and 3. You should have imported all
related data to the Adventure Works project and built a data model based on them.

Objectives
Data Analysis Expressions, commonly known as DAX is the formula language that drives the Power
BI front-end.

1 DAX Calculated Columns


Calculated columns are based on row context.

1. We have created a column named QuantityType in the Sales Data table, using Power Query
in Lab 2. Remove that column and create the same calculated column, this time using DAX.
Reminder: The QuantityType is Single Item if the order quantity is 1. If the order quantity
is more than 1, the QuantityType is Multiple Items.
2. Create an additional column in the Sales Data column, which represents the SUM over all
OrderQuantity of all sales. Does it make sense to do that? If not, remove the column.

2 DAX measures
Measures are DAX formulas used to generate new calculated values. Measures are based on filter
context.

1. Recreate the Sum of Order Quantity as an Explicit measure named Quantity Sold.

2. Create an Explicit measure named Quantity Returned to calculate the Sum of all ReturnQuan-
tity.
3. Create an Explicit measure named Averate Retail Price by Averaging over ProductPrice
in the Product Lookup table.

4. Create an Explicit measure named Total Returns that counts the number of return transac-
tions. Compare Total Returns and Quantity Returns and find out why they are different.
5. Create an Explicit measure named Total Orders that counts the amount of Orders placed.
Make sure that the computation is correct.
6. Create an Explicit measure named Total Customers to calculate the number of distinct cus-
tomers who made a transaction.
7. Create an Explicit measure named Return Rate, defined as quantity returned divided by
quantity sold.

3 Measure tables
It’s a common best practice to create a dedicated table to store your measures. Let’s take a look at how
to do it. Make sure you finished creating this table to stay organized.

@BAI Lab 2

You might also like