0% found this document useful (0 votes)
7 views4 pages

Lab 5 Data Analysis Expressions

Lab 5 focuses on Data Analysis Expressions (DAX) and requires completion of measures related to conditional, logical, text, date & time functions, as well as the CALCULATE and ALL functions. Students must organize their measures in a measure table and can work solo or in pairs, submitting a .pbix file by a specified deadline. The lab includes tasks such as creating calculated columns and measures using various DAX functions based on provided data tables.

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 views4 pages

Lab 5 Data Analysis Expressions

Lab 5 focuses on Data Analysis Expressions (DAX) and requires completion of measures related to conditional, logical, text, date & time functions, as well as the CALCULATE and ALL functions. Students must organize their measures in a measure table and can work solo or in pairs, submitting a .pbix file by a specified deadline. The lab includes tasks such as creating calculated columns and measures using various DAX functions based on provided data tables.

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/ 4

Lab 5: Data Analysis Expressions (DAX), Part 2

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, 3 and 4. You should have imported all
related data to the Adventure Works project and built a data model based on them.

Submission Instructions

(a) Solo? (b) Or pair-wise?

This Lab work can be done solo or as group of two.

Each group must complete Lab 2,3,4,5 and return one .pbix file named student1 student2.pbix.
This file should be returned on Wednesday 14/05/2025 at 23h59 GMT+7 via the NEU e-learning
platform.
If you finish this lab as a group of 2, only one submission from a student is enough.

Objectives
Finish the following measures and organize all measures properly.
IMPORTANT: All measures must be organized in a measure table!!!

1 Conditional & Logical Functions


Logical functions include: IF, IFERROR, SWITCH, AND (&&), OR (||)
1. Use the Customer Lookup table, create a new calculated column Parent. The value of this
column is:
• If number of chilren ≥ 1, Yes.
• Otherwise, No.
2. Use the Customer Lookup table, create a new calculated column Customer Priority. The
value of this column is:
• If the customer is a parent and has an annual income > $100, 000, Customer Priority =
Priority.
• Otherwise, Customer Priority = Standard.
3. Use the Customer Lookup table, create a new calculated column Income Level. The value of
this column is:

@BAI Lab 2
Faculty of Data Science and Artificial Intelligence, NEU

• If annual income ≥ $150, 000, Very High


• If annual income ≥ $100, 000, High
• If annual income ≥ $50, 000, Average
• Otherwise, Low
4. Use the Product Lookup table, create a new calculated column Price Point using the SWITCH
function. The value of this column is:
• If product price ≥ $500, High
• If product price ≥ $100, Mid-range
• Otherwise, Low
5. Use the Customer Lookup table, create a new calculated column Education Category using
the SWITCH function. The value of this column is:
• If education level is High School or Partial High School, Education Category = High School
• If education level is Bachelors or Partial College, Education Category = Undergrad
• If education level is Graduate Degree, Education Category = Graduate
• Otherwise, Education Category = Unknown

2 Text Functions
Text functions in DAX is very similar to EXCEL. Text functions include: LEN, CONCATENATE,
UPPER/LOWER, LEFT/RIGHT/MID, SUBSTITUTE, SEARCH.

1. Use the Calendar Lookup table, create a new calculated column Month Short that extracts
and capitalize the first 3 characters of the month name (e.g. JAN, FEB, MAR, ...).
2. Use the Product Lookup table, recreate the SKU Category column using DAX. The column
extracts every characters before the first ’-’ in the product SKU.

3 Date & Time Functions


Date & Time functions include: TODAY/NOW, DAY/MONTH/YEAR, HOUR/MINUTE/SECOND,
WEEKDAY/WEEKNUM, EOMONTH, DATEDIFF

1. Use the Calendar Lookup table, create a new calculated column Weekend. The value of this
column is:

• If it is a Saturday or Sunday, Weekend


• Otherwise, Weekday
2. Use the Customer Lookup table, create a new calculated column Age. The Age is the difference
between the Birth Year of the customer and the Current Year.

4 The CALCULATE Function


The CALCULATE is the MOST IMPORTANT function in DAX, because it evaluates an expression in
a context that is modified by filters.

1. Create a new measure called Bulk Orders, which is the same as the Total Orders measure, but
this time only counts orders with quantity > 1

2. Create a new measure that computes Weekend Sales, and Weekday Sales, which is the total
orders on Weekend and Weekday respectively
3. Create a new measure named Bike Returns to calculate the total quantity of bikes returned

@BAI Lab 3
Faculty of Data Science and Artificial Intelligence, NEU

4. Create a matrix to show Bike Returns (values) by Start of Month (rows). What do you notice
about the volume of bike returns over time?
5. Create a new measure named Bike Sales to calculate the total quantity of bikes sold, and add it
to the matrix. What do you notice?

6. Create a new measure named Bike Return Rate using either CALCULATE or DIVIDE, and
add it to the matrix

5 The ALL Function


The ALL function returns all rows in a table, or all values in a column, ignoring any filters that have
been applied

1. Create a new measure named All Returns to calculate the total number of returns, regardless of
filter context
2. Create a new measure named % of All Returns that divides Total Returns by All Returns

6 Advanced CALCULATE and Date Function


Add the following measures to the model:
1. Previous Month Returns

2. Previous Month Order

@BAI Lab 4

You might also like