MoI II DAX & Calculated Columns
MoI II DAX & Calculated Columns
Ms Chouhan
Mr Mollayev
Mr Smeding
MANAGEMENT OF
INFORMATION II
Workshop 6
Content and Learning objectives of today
Content LOs
Explore time-based data / Calculated Create a Date Table
tables / Create a Date Table
Analyze data with DAX / Basic DAX Able to write DAX expressions
functions / Calculated columns / Create
DAX formulas for calculated columns
Prepare a report / tables in Power BI Prepare a Matrix
Homework
Management of Information II
Homework last week
Management of Information II
Working Steps in BI tools
Management of Information II
DAX overview
Data Analysis Expressions (DAX) is a formula expression language used in Analysis
Services, Power BI, and Power Pivot in Excel.
DAX formulas include functions, operators, and values to perform advanced
calculations and queries on data in related tables and columns in tabular data models.
DAX is essential to creating effective data models.
Excel performs calculations over cells. DAX works on tables and columns, not cells.
DAX formulas are used in measures, calculated columns and calculated tables.
Management of Information II
DAX overview
There are over 250 functions in
DAX;
DAX has many common functions
with Excel. However, DAX is much
more powerful than Excel formula;
DAX functions are combined by
types.
Management of Information II
DAX data types
Management of Information II
DAX operators
To perform basic mathematical operations such as addition, subtraction, or multiplication; combine
numbers; and produce numeric results, use the following arithmetic operators.
Management of Information II
Calculated tables – Date table
You can create a date table by using a DAX function CALENDAR and CALENDARAUTO.
CALENDAR and CALENDARAUTO generate a one-column table of datetime data type called Date.
Management of Information II
Calculated tables – Date table
What does calendarauto do:
CALENDARAUTO function (DAX) - DAX | Microsoft Docs
Management of Information II
DAX formulas for Calculated
columns
A calculated column is an additional column in a
table that you define with a DAX formula.
Management of Information II
Mark your date table as a date table
Note: Select the date table>right click>Mark as date table>select the date column
Management of Information II
Data Model
Relate your date table to your
central/main table
Management of Information II
Using DAX functions in Calculated
columns
DAX relational function RELATED
returns a related value from another
table.
The RELATED function requires that a
regular relationship exists between the
current table and the table with related
information.
RELATED Can access the one-side from
the many-side because in that case only
one row in the related table exists if Note: Use function RELATED to get data from
any. If no such row exists, RELATED the look up table into the central table and
returns BLANK. calculate total revenue and costs
If a relationship does not exist, RELATED
raises an error.
Management of Information II
Related table
products sales
productID product price salesID productID date quantity revenue
1 € 14,99 10 2 1-10-2022 2 ?
2 € 21,25 11 2 2-10-2022 3 ?
3 € 39,10 12 1 2-20-2022 1 ?
13 3 3-20-2022 2 ?
Management of Information II
In-class exercises
There are 2 inclass exercise, same company, but different data model
• DAX inclass exercise related
• DAX inclass exercise calculated columns
Management of Information II
Homework
• See brightspace
Management of Information II