PL 300

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 89

Activity: Configure table and column properties

Introduction

In the previous lesson, you learned how to configure the table and column properties of various
tables of a data model. This activity is designed to empower you with hands-on experience in
configuring and formatting both table and column properties in Microsoft Power BI Desktop.
Specifically, in this activity, you will cover how to:

 Configure and format the table properties of your data model so that it is intuitive for the
collaborators

 Format column properties such as data type and category so that the analysis provides
accurate insights into the data

Scenario

Adventure Works management needs an accurate analysis of their sales data in a visually appealing
dashboard. The first step in every analysis is preparing the data, where you need to perform
formatting and configuration of the table and column properties within your data model. This will
help you to visualize data accurately with properly formatted fields to avoid any confusion.

Instructions

Step 1: Download and open the Adventure Works.pbix Power BI project

Download the Adventure Works Power BI project file and save it to your computer. The data model
contains four data tables: Sales, Products, Salesperson, and Region. The dimension tables are
related to the fact table via one-to-many relationships.

Adventure Works Data

XLSX File

Adventure Works

PBIX File

Step 2: Navigate to Model view and configure the table properties

Model view in Power BI provides many options to update and configure the table and column
properties.

1. Once you launch Power BI and open the Adventure Works project, navigate to Model view to
inspect the data model tables. The model contains four tables: Sales, Products, Salesperson,
and Region. Sales is the fact table, while others are dimension tables.
1. Select the Sales table and expand the Properties pane of the Model view. The Properties
pane has two sections for formatting the table properties: General and Advanced.
1. In the General section, you can format the following:

o Name and Synonyms: For this activity, you can keep the name and synonyms of the table
default.

o Description: The table description provides additional information or context about the
table. For example, you can write, The sales table contains sales transactions from 2017 to
2020 for Adventure Works global operations. This information will provide appropriate
context for the report and dataset collaborators without the need for them to dig deep into
the data structure.

o Row label: A row label allows you to define which column or field best identifies a single row
in a table. This field is especially useful in dimension tables. For example, in the Product
table, you can define the Product Color field as the row label. This enables the Power BI Q&A
functionality to create more helpful visuals when your report users ask specific questions.

o Key column: This column provides the unique values of the data table. In the Sales table, the
key column is SalesOrderNumber. Select this from the drop-down field options.

o Whether the table is hidden or not (Is hidden): You can hide the table from the Report view
of Power BI Desktop by sliding the Is hidden toggle on. This feature is useful in aggregated
tables while using DirectQuery connectivity. You do not need to configure this feature for this
activity. Note: You can also rename the table and add a description in the Query Editor of
Power BI.
1. In the Advanced section of the Properties pane, you need to set the storage mode of the
table. Currently, there is only one storage mode available—Import. Note: Power BI supports
two more storage modes: DirectQuery and Dual Storage.

Step 3: Configure the column properties

1. Select the Total Sales column from the Sales table. Under the General section, you need to
format the following properties:

o Name and Synonyms: You can leave these sections as default for this activity. However, keep
in mind that you can change them if needed by your organization to meet specific business
requirements.
o Description: In the description section, you can write additional details of the measurement
presented in the column. For example, in the current example, type in Sales amounts in
USD. This information specifies the currency.

o Note: In any activity related to configuring properties, you do not necessarily need to
configure all properties. This will depend on your dataset and what is required for your
analysis. This activity mentions the various properties that you can configure, but not all will
require configuration in the current context.

o Display folder: This is the utility feature where you can organize your measures and columns
into folders.

o Is hidden: The last property is whether you want to hide the column from the Report view.
This is useful if you want to hide some sensitive information from report viewers.

1. In the Formatting section, you need to format the following column properties:

o Data type: You need to select an appropriate data type depending on the field. For example,
the Total Sales column contains sales amounts that should be in decimal number format. If
not selected, choose Decimal number from the drop-down options.
o Format: By default, General is selected. You need to select Currency from the drop-down.
This formatting will display a $ sign before the sales amounts and is easy to comprehend for
the report users. A new field appears where you need to specify the currency format. Select
$ English (United States). This feature allows you to display sales amounts in different
currencies for overseas operations.
o Percentage format: By turning this toggle feature to the on position, Power BI displays the
values as percentages. You do not need to configure this feature for the current activity.

o Thousands separator: Turn this feature on in order for Power BI to display a thousand
operator in the sales amount.

o Decimal places: Auto is selected by default. Enter 2 to specify the decimal places for your
fields or measures.

1. Finally, in the Advanced section, you need to configure the following column properties:
o Sort by column: This feature allows you to sort a field based on another column, depending
on your visualization requirements. For example, you can sort the month name column
either alphabetically or by month number. In this case, you can leave the default selection.

o Data category: This formatting is important while working with location-based data. For
example, select the Country column from the Region table and then select Country/Region
as the data category. Power BI detects this field as a country to accurately display the
geographical boundaries on the map visual. A globe map icon appears before the field name.
o Summarize by: This feature tells Power BI what arithmetic operation should be applied
during aggregation and visualization. Sum is selected by default. You can keep this as is for
the activity.

o Is nullable toggle: Turn this on only if your column or field contains null values. You do not
need to turn this on for the current activity.

1. Alternatively, you can also format the column properties from the Column tools tab in Power
BI. You can access this tab from the Data view of Power BI Desktop.
Conclusion

Formatting the tables of a data model and configuring their column properties are essential
components of data analysis and visualization in Power BI that you will be assessed on in your
Microsoft PL-300 exam. It also empowers you to seamlessly collaborate with your team members
and stakeholders during the analytical process.

Activity: Common date tables

Introduction

When working as a data analyst in Microsoft Power BI, creating a common date table can be a
valuable asset for your data analysis and visualization tasks. Date tables enable you to filter, group,
and analyze time-related data effectively. In this activity, you will explore why a date table is
important within your date model and how to create one.

Why date tables are important

Before revisiting the steps involved in creating a date table in a Power BI data model, it is important
to cover why having one is crucial in Power BI. A date table can help you in performing time-
intelligence calculations like year-to-date or month-to-date aggregations. It can also be used to
create custom time periods like fiscal years.

A common date table also helps in creating an effective data model. With a dedicated date table, you
can easily relate it to other tables of the data model that have date-related information, which will
improve the performance of your Power BI reports and visualizations.

Pre-requisites for date table creation

Before you start creating a date table in Power BI, there are some prerequisites you should have in
place.
 Date column: Your data model must contain a date column with a Date/time data type. This
table will serve as the basis for building the date table.

 No blanks: A date column should not have any blank values, meaning every row needs to
have a valid date.

 Unique values: A date table should have unique values meaning each date should appear
only once in the date column.

 No missing dates: There should be no dates missing from a date column, especially if you are
working with continuous time periods.

Creating a date table

In Power BI, you can use Power BI’s Auto date/time function for simple time intelligence calculations,
but it is not suitable to perform complex DAX logic. You can create a common date table within your
data model using DAX, Power Query with M, and even Pandas in Python and import the table to your
model. For the current activity, you will focus on creating a date table using DAX.

Instructions

Step 1: Download and launch the Power BI project Adventure Works.pbix

 Download the Adventure Works Power BI project file and save it to your computer. The data
model contains five data tables; Sales, Product, Region, Reseller, and Salesperson. The
model does not have a dedicated date table, which you will create in this activity.

Adventure Works

PBIX File

Step 2: Create a date dimension table using DAX

1. Access the Model tab in Power BI to view the data model. Note that there is no date
dimension table present in your model.
1. Navigate to the Home ribbon and select New table from the calculations group. In the
formula bar, input the following DAX code using the CALENDAR function to create a table
with a single column containing dates:

o Date = CALENDAR ( DATE( 2017, 1, 1 ), DATE ( 2021, 12, 31 ) ) Note: In the CALENDAR
function, you need to specify the start and end dates. The Adventure Works sales data starts
in 2017 and ends in 2020. The start date must occur on or before the date column of the
dataset. The end date must be on or after the end date of the dataset.

1. Execute the code to generate a table with a single date column containing a list of dates with
time.
1. Alternatively, if you want to create a date range more specifically according to the dataset,
you can specify the start and end date taken from the OrderDate column of the Sales table
in the DAX script. The DAX script is as follows:

o Calendar = CALENDAR ( MINX( Sales, Sales[OrderDate] ), MAXX ( Sales, Sales[OrderDate] ) )


Note: In the above formula, the use of MINX and MAXX functions takes the minimum date
value and the maximum date value from the OrderDate column of the Sales table.

1. Next, you need to format and configure the table. Select the Date column and navigate to
the Column tools tab. Rename the column as Date and format the column as Date data type.

1. Select the appropriate date format from the format drop-down list of options.
1. To populate the Date dimension table with related columns like year, month number, month
name, day of the week, and week number, select New column from the Calculations group
of the Column tools tab to expand the DAX formula bar.

2. Enter the following DAX code in the formula bar, as demonstrated in the screenshot below.

o Year = YEAR ( 'Date'[Date] )

1. Repeat the process by entering the following DAX code, one in each step.

o Month =FORMAT ( 'Date'[Date], "MMMM" )

o Month Number =MONTH ( 'Date'[Date] )


o Day of the Week =FORMAT ( WEEKDAY( 'Date'[Date] ), "dddd" )

o Week Number =WEEKNUM ( 'Date'[Date] ) Note: The date-related functions in the above
DAX formulas, like YEAR, MONTH, WEEKNUM, and WEEKDAY extract the relevant
information from the Date column of the table. You can add more columns to your date table
in a similar way as per your analytical requirements.

Step 3: Mark the table as a date table in Power BI

1. Once you have created a date table, you need to mark the newly created date dimension
table as a date table. To do this, select the ellipses on the right side of the date table and
select Mark as date table from the drop-down list of options.

1. This opens a Mark as date table dialog box. Select the Date option from the Date column
drop-down menu. Once the dialog box displays the message Validate successfully, select
OK.
Now, DAX performs all its calculations based on the newly created date dimension table.

Step 4: Establish a relationship between the Date table and the Fact table of the data model

1. A Date table now appears in the Model view of Power BI.

1. You need to establish a relationship between the Date and the fact table in the data model,
which is the Sales table in the current model. The Date dimension table is ready for analysis
and reporting in your data model.
Step 5: Save the project

 Save the Power BI project with the new Date table as a new project. Make sure to provide an
appropriate name and path to the folder on your local computer.

Conclusion

Congratulations! You have successfully created a common date dimension table in a data model
using DAX. Now you can perform meaningful time intelligence calculations and measures to group
and slice and dice data according to business needs. As a Power BI data modeler and analyst,
mastering this skill will help you build efficient and scalable data models.

In-depth: Design a data model

Introduction

A data model is the backbone of any Power BI project, and its significance cannot be overstated. It is
the foundation for all reporting, analysis, and visualization in Microsoft Power BI. By completing this
lesson, you’ve prepared for the data modeling section of the PL-300 exam. If you'd like to delve
deeper into the topics covered you can revisit content in previous courses in the Microsoft Power BI
Analyst Professional Certificate program which will provide additional details and insights.

Concepts for data modeling

Introduction to data models

In Data modeling in Power BI you can review the week one lesson Introduction to data models to
discover fundamental concepts of data models and schema design. In Power BI, you can design
several types of schemas, of which the most commonly employed for data analysis is the star
schema.
The lesson Working with advanced data models in week two of Data modeling in Power BI will
provide key knowledge and information on the snowflake schema, a key data model design.

Introduction to Cardinality and cross-filter direction

In Data modeling in Power BI you can review the week one lesson Introduction to cardinality and
cross-filter direction. This lesson explores fact and dimensions tables, the key elements of star and
snowflake schema design, and other essential elements and data modeling like normalization,
cardinality, and cross-filter direction.

Cardinality, at its core, is the nature of relationships between the tables of a data model. The lesson
Introduction to cardinality and cross-filter direction to also explores the distinct types of relationships
possible between data tables and the direction of filter propagation.

Using Data Analysis Expressions (DAX) in Power BI

Working with measures

The lesson Working with measures in week two of Data modeling in Power BI can help you to review
how to use the CROSSFILTER function with the DAX language to alter the cross-filter direction
temporarily to achieve a specific analytical objective.

The Working with measures lesson will also help you to understand evaluation context and its two
types, row and filter context, understanding that is the key to DAX comprehension.

In Working with measures you can also gain a fundamental knowledge on how row and filter context
impact DAX measures. You can explore the CALCULATE function, which has a special significance
because of its ability to alter the filter context of measures and apply it in computing measures to
integrate FILTER arguments.

DAX and table relationships

A review of the lesson DAX and table relationships in week two of Data modeling in Power BI will
help you to understand role-playing dimensions and gain hands-on skills in configuring a role-playing
dimension to deal with multiple relationships between one dimension and a fact table in the data
model.

In this lesson you can also explore the application and use of USERELATIONSHIP function in-depth.

Conclusion

Data modeling is the keystone to effective data analysis and visualization. It transforms raw data
table into structured, integrated, and secure foundation that supports the creation of insightful and
user-friendly reports and dashboards. You need to master the skill of building and configuring an
effective data model to pass the Microsoft PL-300 exam and to excel as a Power BI Analyst.

Additional resources: Design a data model

Introduction

In this lesson, you learned one of the most fundamental and essential concepts in data analysis—
data modeling and DAX calculations. Designing and configuring a schema design in Microsoft Power
BI is the foundation for an accurate analysis that enables you to reveal insights for strategic decision-
making. Below are some useful resources you can explore to enhance your knowledge of modeling
and schema.
Schema and column properties

Schema design in Power BI is like an architectural blueprint for a building. It is the foundation upon
which the entire structure of your data model rests. Just as a well-designed blueprint ensures a
stable and efficient building, a thoughtful schema design is crucial for a robust and efficient Power BI
business solution. Microsoft Learn provides a thorough guide to developing and configuring schema
for your Power BI solutions.

Role-playing dimension

As a Power BI developer, you will come across situations where a one-dimension table can have
multiple relationships with the fact table of the data model as active and inactive relationships.
These dimensions are called role-playing dimensions. You have learned how to handle an inactive
relationship in a data model by implementing a role-playing dimension or using the
USERELATIONSHIP DAX function. To further excel and gain the most up-to-date information about
this topic, you can consult Microsoft Learn resources about the relationships and the functioning of
the USERELATIONSHIP function in DAX.

The CALCULATE function

The DAX CALCULATE function of DAX serves as the foundation of DAX. This is the only function, along
with its sister function CALCULATEABLE that can alter the filter context of DAX calculations. To enjoy
the real analytical powers of Power BI, it’s important to understand how evaluation context works
while computing DAX measures and how CALCULATE provides you with a whole new avenue of
opportunities. To grasp both these concepts more deeply, you can review Microsoft Learn materials
on evaluation context and CALCULATE functions.

Cardinality and cross-filter direction

The analysis and key takeaways from your data depend on the nature of relationships between
various tables of your data model and the direction of filter propagation. You gained hands-on
experience in creating and configuring the cardinality of relationships and filter direction.
Understanding these concepts is essential in designing an effective data model. With these concepts,
you can configure and control the relationship between tables, which in turn determine how data is
filtered and aggregated, ultimately influencing the quality and accuracy of your data analysis and
visualization. To gain more in-depth knowledge, consult topics on Microsoft Learn about creating and
managing relationships in the Power BI model.

Conclusion

As part of your journey to becoming a certified Power BI Analyst through the Microsoft PL-300 exam
and to succeed in the real-world analytics market, further enhancing your knowledge of data
modeling and schema design will be an asset. Therefore, it’s important that you continue to review
more resources on best practices for designing schema and configuring data models according to
your business needs.

Activity: Add a SUM aggregation measure

Introduction

You have a solid understanding of what measures are, how these can reveal the hidden message in
your data, and how you can create them using DAX. Although you can use a rich library of DAX
functions to compute measures required to fill the gaps in your data analysis, in this activity, you will
use the SUM DAX function to compute measures for Adventure Works.

Scenario

Adventure Works' sales manager asks you to provide her with a quick overview of the company's
total profit. The dataset has a Sales Fact table containing Unit Price, Quantity, and Cost columns. No
information is available about the profit. With the power of DAX, you can create measures to help
the sales manager with her strategic decisions.

Instructions

Step 1: Download the Adventure Works Sales file

Adventure Works Sales

PBIX File

 Download and save the Adventure Works Sales.pbix file to your computer. The data model
contains four related tables: Sales, Products, Region, and Salesperson.

Note: The data model is configured for appropriate relationships and cross-filter direction, and the
dataset is cleaned and transformed to eliminate duplicate values.

Step 2: Create measures using DAX

1. To create a new measure in the Sales table, select the Sales table from the Data pane on the
right side of the Power BI Desktop interface. Navigate to the Calculations group in the Data
view and select New measure, which will expand the formula bar.
1. Write the following DAX script in the formula bar and execute by pressing the Enter key:

Total Sales = SUMX ( Sales, Sales[Unit Price] * Sales[Quantity] )

Note: As you learned previously:

 The SUMX function iterates over each row to calculate the total sales.

 Sales is the table name to be referenced.

 Unit Price and Quantity in square brackets are the columns that must be multiplied to
calculate the total sales.
1. You also need to calculate the Total Cost of the products to subtract it from the Total Sales to
calculate the profit. To compute the Total Cost, repeat the process of creating a measure and
write the following formula:

Total Cost = SUM ( Sales[Cost] )

Note: In this formula, you used SUM instead of SUMX because only one column is referenced to
compute the Total Cost.

1. Next, you can create a third measure to subtract the Total Cost from the Total Sales to
compute the company's total profit:

Total Profit = Sales[Total Sales] - Sales[Total Cost]


Step 3: Format measures

1. Select the Total Sales measure from the Sales table and navigate to the Measure tools tab.
You need to select Currency from the Format drop-down.

1. Enter 2 decimal places in the Formatting section.

1. Repeat the same process for the other two measures.

Step 4: Create a matrix to visualize the measure in context

1. Select the Matrix visual from the Visualizations pane and bring, for example, the Country
column from the Region table to the matrix.
2. Next, add the Total Sales and Total Profit measure to the matrix. Now the Total Sales and
Total Profit measures are computed by taking Country in the filter context.

Note: You can visualize these measures similarly by product categories, products, salespersons, and
so on.

Step 5: Save the Power BI project

 Save the Power BI project. Make sure to provide an appropriate name and path to your
project.

Conclusion

Measures are dynamic calculations that summarize, aggregate, or analyze data as needed. In this
activity, you successfully created measures using SUM and SUMX functions to help analyze the data
that was originally not present in the data tables. The Microsoft PL-300 exam tests your ability to
create measures using DAX and integrate the filter context within the measures.

Activity: Replacing implicit measures

Introduction

You have an Adventure Works dataset that contains a Sales fact table. When you drag the Total Sales
values to the report canvas for visualization, Microsoft Power BI automatically summarizes the sales
values and displays the total amount instead of individual sales amounts. This is called an implicit
measure. In this activity, you will disable the summarization function of the sales implicit measure
and create an explicit measure by writing a DAX expression or using Power BI’s quick measures
feature.
Implicit measures and aggregation in Power BI

You may recall that, in Power BI, an implicit measure is indicated by a sigma (sum) sign before the
column name, and this icon is visible before every numeric column. Power BI sets all numeric
columns automatically to summarizable, meaning whenever you create visualizations from these
columns, Power BI displays the aggregation instead of individual values. You can change the
aggregation type of implicit measures in the visuals or disable the aggregation. The steps that follow
will guide you through turning off an implicit measure and replacing it by implementing an explicit
measure.

Instructions

Step 1: Download and save the Adventure Works Sales.xlsx file. Import the Excel file into Power BI

Adventure Works Sales

XLSX File

Step 2: Create a table/matrix visualization

1. To check how implicit measures work, select a Table visual from the Visualizations pane and
drag the Total Sales field from the Sales table to the Table visual.
A single aggregated value is displayed because Power BI auto-aggregates the numeric column.

1. Next, you need to create a Table visual to display the sales values for each month of the year.
Drag the Year, Month, and Total Sales columns from the Sales table to the matrix. Power BI
displays the aggregation of sales values by taking Year and Month as filter context.
1. Now, you need to disable the aggregation of the implicit measure. Select the small drop-
down or expand arrow beside Total Sales from the Columns well of the Table visual.

1. Select Don’t summarize from the drop-down menu that appears, displaying all the available
aggregation options.
1. Power BI now displays the individual sales values. Repeat the same process for the second
table displaying monthly sales amounts.

Step 3: Create explicit measures

You can create explicit measures by utilizing the Quick measure functionality of Power BI. However,
for this exercise, you need to write a DAX script to define the total sales.

1. You can create a Sales measure using DAX in two ways. First, by using the SUM function,
which aggregates the values from the Total Sales column as:

Sales = SUM ( Sales[Total Sales] )


1. The second way is by using the SUMX function that will multiply the Unit Price column with
the Quantity column and iterate each row of the entire table.

Revenue = SUMX ( Sales, Sales[Quantity] * Sales[Unit Price] )

Step 4: Add the newly created explicit measures to the table visuals

1. You need to replace the Total Sales column with the explicit measures you created using DAX
in the existing tables. The Sales and Revenue measures now provide the aggregated values
by taking any filter context into account, which, in this case, is Year and Month. Note: There
is no difference in values between the two measures computed using different DAX formulas.
1. Save all changes to your project. You can create similar measures using other numeric
columns in the dataset, like quantity.

Conclusion

Although there are no differences in the performance of implicit and explicit measures, explicit
measures provide a more flexible approach because you can define a custom logic in DAX
expressions.

Statistical functions cheatsheet

Introduction

Data Analysis Expressions (DAX) is a powerful formula language of Microsoft Power BI that includes a
variety of function categories. One of the important categories of DAX functions is statistical
functions that are essential for performing advanced data analysis. Another important category,
Aggregation functions, will also be addressed in this cheatsheet.

Statistical functions

These functions calculate values related to statistical distributions and probability. Common
statistical functions include:

 STDEV.P(<columnname>): Returns the standard deviation of the entire population.

Parameter Definition

ColumnName The name of an existing column using standard DAX syntax, usually fully qualified. It cannot be an expre

 MEDIAN(<column>): Returns the median of numbers in a column.


Parameter Definition

Column The column containing the numbers for which the median is to be calculated.

 RANKX(<table>, <expression>[, <value>[, <order>[, <ties>]]]): Returns the ranking of a


number in a list of numbers for each row in the table argument.

Parameter Definition

Table Any DAX expression that returns a table of data for which the expression is evaluated.

Expression An expression that returns a scalar value. The expression is evaluated for each row of the table to generate
possible values for ranking.

Value This is an optional parameter. An expression that returns a single scalar value whose rank is to be found.

Order A value specifying how to rank values, ascending, or descending. Also an optional parameter.

 MEDIANX(<table>, <expression>): Returns the median of an expression evaluated for each


row of the table.

Parameter Definition

Table The table containing the rows for which the expression will be evaluated.

Expression The expression to be evaluated for each row of the table.

 NORM.DIST(x, mean, standard_dev, cumulative): Returns normal distribution.

Parameter Definition

X The value for which distribution is required.

Mean The arithmetic means of the distribution.

Standard_dev The standard deviation of the distribution.

Cumulative This is a logical value determining the form of the function. Cumulative = TRUE returns cumulative distri
while FALSE returns probability density function.

 T.DIST(x, deg_freedom, cumulative): Returns student’s left tail t-distribution.

Parameter Definition

X The numeric value for which the distribution is required.

Deg_freedo An integer that represents the number of degrees of freedom.


m

Cumulative This is a logical value determining the form of the function. Cumulative = TRUE returns cumulative distri
while FALSE returns probability density function.

 VAR.S(<columnname>): Provides the variance of a sample population.

Parameter Definition

ColumnName The fully qualified name of the existing column using standard DAX expression. This cannot be an expre
Parameter Definition

Aggregation functions

 AVERAGE(<column>): Provides the average (arithmetic mean) of all values in a column.

Parameter Definition

Column The column containing numeric values for which the average is required.

 COUNT(<column>): This function counts the number of rows in the specified column that
contains non-blank values.

Parameter Definition

Column The column name containing values to be counted.

 COUNTBLANK(<column>): Used to count the number of blank cells in a column.

Parameter Definition

Column The column name containing blank cells to be counted.

 COUNTROWS([<table>]): This function counts the number of rows in a specified table or a


table returned by an expression.

Parameter Definition

Table The name of the table for which rows to be counted. This can also be a DAX expression that returns a table
not provide the table name, the engine takes the home table as default for the expression.

 DISTINCTCOUNT(<column>): Provides the distinct values from a column.

Parameter Definition

Column The name of the column containing the values to be counted.

 MAX(<Column>): Provides the largest number in a column or between two scalar


expressions.

Parameter Definition

Column The name of the column from which the largest number to be found.

 MIN(<column>): Return the smallest value from a column or between two scalar
expressions.

Parameter Definition

Column The name of the column from which the smallest number to be found.

 SUM(<column>): Sum up all values from a column.

Parameter Definition

Column The name of the column from which the addition of values is required.
Parameter Definition

Conclusion

Certain functions in both statistical and aggregation categories have variations, like MINX, SUMX,
MEDIANX, and so on. Practice is the key to mastering these functions. In the real world, you will
create many measures where these functions will help you to fulfill the analytical needs of
businesses.

Activity: Create a semi-additive measure

Introduction

Semi-additive measures can be aggregated across some dimensions but not for others. Time is one
of the main dimensions. Inventory and account balance are classic examples of semi-additive
measures. This activity will equip you with the hands-on skills for handling semi-additive measures
like inventory on hand.

Scenario

The product manager at Adventure Works needs up-to-date information about the product stock on
hand to make important decisions about new product acquisition and manufacturing. Creating
measures using a simple SUM function will not solve the problem. You need to use DAX functions
that can handle semi-additive measures to provide accurate inventory on-hand information to the
product team. Let’s explore how you can do this in DAX and Microsoft Power BI.

Instructions

Step 1: Download the Excel file.

Adventure Works Inventory

XLSX File

 Download and save the Adventure Works Inventory.xlsx file. Import the Excel file into Power
Bi. The data model contains only a single table called Inventory. The table contains
information like StockLevel and Date required to create measures.
Step 2: Create a measure using SUM and visualize data in table visual.

1. Create a DAX measure using the SUM function to compute the total stock level from the
dataset. You need to write the following DAX script:

Product Inventory = SUM ( 'Inventory'[StockLevel] )

Note: The SUM function is simply summing up the values from the StockLevel column of the
Inventory table.

1. Create a Table visual to visualize the results of the Product Inventory measure. The values
represent the sum of all the products in stock at a given time and do not reflect the stock on
hand.
Step 3: Create measures using the LASTDATE function.

1. To gain information about the current stock on hand at the end of each month, you need to
write a DAX expression using the LASTDATE function inside the CALCULATE function:

Closing Balance = CALCULATE ( 'Inventory '[Product Inventory], LASTDATE ( 'Inventory '[Date].[Date] )


)

In the above DAX expression, LASTDATE takes the last date of the month to calculate the stock on
hand by using the Date as a parameter.
1. You can bring the Closing Balance measure to the matrix to visualize the results. Note that
March and May have blank Closing Balance values in the matrix because the DAX expression
uses the last date, and if that date is a weekend or holiday, it returns as blank.

1. To overcome this issue, you need to use the following LASTNONBLANK function

Closing Balance (Non-blank) =

CALCULATE (

'Inventory '[Product Inventory],

LASTNONBLANK (

'Inventory '[Date].[Date],

'Inventory '[Product Inventory]

)
In the above expression, the LASTNONBLANK function uses the value for the last day of the month
that is non-blank, thereby ignoring any holiday or weekend.

1. Next, drag the Closing Balance(Non-Blank Measure) to the matrix to visualize the results.
Now, the matrix represents the accurate value for stock on hand for each month-end.

Step 4: Create measures to display the opening balance.

1. You can compute each month's opening balance similarly by using FIRSTDATE instead of
LASTDATE. The DAX code for the measure is:

2
3

Opening Balance =

CALCULATE (

'Inventory'[Product Inventory],

FIRSTDATE ( 'Inventory'[Date].[Date] )

)
1. Displaying the Opening Balance measure in the matrix raises the same issue because of non-
working data at the start of the month. You can solve this by using the FIRSTNONBLANK
function as follows:

Opening Balance (Non-blank) =

CALCULATE (

'Inventory'[Product Inventory],

FIRSTNONBLANK ( 'Inventory'[Date].[Date], 'Inventory '[Product Inventory] )

The results of the measure are displayed in the matrix:


1. Apply all changes to your Power BI project.

Conclusion

You have successfully managed the semi-additive measure of inventory on hand and provided the
most accurate information about the number of in-stock products in any given warehouse. This
information empowers users to make strategic decisions.
Path DAX functions

Introduction

As a data analyst in a retail store, you're surrounded by a wealth of data from sales, customer
interactions, and product movements. You deal with complex data structures, like product categories
and employee roles, all of which form a big puzzle. Understanding these data hierarchies is key to
fully utilizing your data, linking sales to customers and team operations. In this process, you've
started using Path DAX functions in Power BI.

This reading aims to assist you in understanding the workings and applications of Path DAX functions
in Power BI. By the end of this reading, you’ll understand the specific roles and uses of each Path DAX
function–PATH, PATHCONTAINS, PATHITEM, PATHITEMREVERSE, and PATHLENGTH.

Path DAX functions

PATH function

The PATH function in Power BI helps create hierarchical structures from data, turning complex
relationships into clear paths. This function is important for analyzing hierarchical data and making it
easier to understand connections between different data points. It's particularly useful in visualizing
structures like organizational charts or product hierarchies, adding clarity to Power BI reports. For
example, the PATH function can show the reporting structure in a company by turning employee and
manager data into a string that outlines the chain of command, helping in understanding company
dynamics and workforce planning.

EmployeePath = PATH(Employees[EmployeeID], Employees[ManagerID])

PATHCONTAINS function

PATHCONTAINS in Power BI is used to check if certain items are in a hierarchy, helping to filter and
segment data accurately for precise analyses and reports. It's useful when you need to focus on
specific parts of a larger group, like finding certain products in a category or employees in a
department. For example, you can use PATHCONTAINS to determine if Organic products are in the
Food & Beverages category, aiding in targeted product analysis or marketing.

IsManagedBy5 = PATHCONTAINS([EmployeePath], "5")

PATHITEM function

PATHITEM in Power BI is important for pulling out specific layers of hierarchical data, enabling
detailed analysis. It's great for situations where you need to focus on specific details, like examining a
particular product line in a category or understanding a team member's role in an organization.
PATHITEM increases the accuracy of your Power BI analyses and reports. For instance, if you're
exploring a company's divisions, PATHITEM can identify the Marketing department within the Sales
and Marketing division for more targeted analysis and reporting.

DirectManagerID = PATHITEM([EmployeePath], 2)
PATHITEM reverse

PATHITEMREVERSE in Power BI is used for tracing data paths backwards. It's useful for understanding
how individual elements fit into the bigger picture, such as how a product fits into a category or a
role in an organization. This function helps provide a broader context in various scenarios, enhancing
Power BI reports. For example, with a specific laptop model, PATHITEMREVERSE can trace back to its
broader category, like Electronics, showing how specific products are categorized.

TopLevelManagerID = PATHITEMREVERSE([EmployeePath], 1)

PATHLENGTH function
PATHLENGTH in Power BI measures the depth of hierarchical structures, showing the breadth and
complexity of things like product ranges or organizational charts. It helps to understand how
extensive a hierarchy is. For instance, you can use it to find out how many levels there are in product
categories. A high PATHLENGTH in a category like Home Appliances suggests a large variety of
products, which is useful for inventory and marketing planning.

HierarchyDepth = PATHLENGTH([EmployeePath])

Conclusion

As a data analyst, remember that the real value of Path DAX functions goes beyond just organizing
data and creating reports. They help you to discover insights and strategies that allow you to make
an impact. In the world of retail, where details matter, these functions give you the ability to see and
understand the bigger picture, one data point at a time.

In-depth: Create model calculations using DAX

Introduction

Data Analysis Expressions (DAX) is the key to mastering data models and exploring the insights that
are hidden in your raw data. DAX enriches your data model with its capacity to expand its analytical
power with calculated columns and measures.

By completing this lesson, you’ve prepared for the data sources section of the PL-300 exam. If you’d
like to delve deeper into the topics you’ve covered in the Microsoft Power BI Analyst Professional
Certificate program, you can revisit the content in previous courses.

Calculated columns
In Data Modeling in Power BI you can explore the role of calculated columns and gained hands-on
experience creating them in the lesson Introduction to DAX. Microsoft Power BI supports several
types of columns that you can add to your data model to enhance your analysis and visualization.

Discover the most practical way to add a calculated column to your data model by defining a DAX
expression by reviewing DAX table functions in the lesson Introduction to DAX.

Measures and DAX

Creating measures using DAX is like discovering the unseen using a microscope. In Power BI data
analysis, using DAX to create business-specific measures is routine work for analysts. Gain a
comprehensive conceptual framework for creating measures and understanding DAX syntax in
Introduction to Measures and Types of Measures.

In the course Data Modeling in Power BI, you can learn more about this in week 2 lesson
Introduction to measures and Types of measures. Explore evaluating context along with the
CALCULATE function, which serves as the backbone of DAX, in detail in Context and DAX Measures in
week 2 content DAX measures and context in business.

Finally, you can build practical skills in creating measures for Adventure Works to visualize sales and
profitability of the company by completing Exercise: Adding a measure in week 2 lesson Working
with measures.

Time intelligence functions in DAX

Time is the most crucial dimension in data analysis, and understanding its impact is often the key to
making smart decisions. Time intelligence DAX functions play a pivotal role in performing temporal
analysis, moving averages, cumulative totals, period-to-date calculations, and many more to assess
the growth of the organization.

Explore time intelligence functions in detail, their significance, their types, and how to create them
practically in the course Data Modeling in Power BI, week 2 lesson Time intelligence calculations in
DAX.

Conclusion

DAX is more than just a formula language; it is a bridge that transforms raw data into actionable
insights. Its versatility and rich function library make it an indispensable tool for data analysis. To
excel as a Power BI analyst and get certified through the Microsoft PL-300 exam, you need to pay
special attention to DAX and its functions. In the Microsoft PL-300 exam, a considerable number of
questions are related to DAX. Your dedication to mastering this skill will undoubtedly pave the way to
your success!

Additional Resources: Create model calculations using DAX

Introduction

In this lesson, you continued your learning of DAX by computing calculated columns and measures.
You reviewed various DAX functions to compute three types of measures: additive, semi-additive,
and non-additive measures. You also covered time intelligence functions, which hold immense
significance in time-based analysis and for predive analytics. Below are some useful resources you
can explore to enhance your knowledge of modeling and schema.

Calculated columns
Calculated columns are an essential component of data analysis in Microsoft Power BI. They equip
you with the skills to explore hidden information in your datasets and answer business-specific
questions by adding new fields to your data table based on existing information. Microsoft Learn
offers resources that provide additional information about calculated columns in Power BI.

Measures and DAX

DAX measures empower you to customize calculations, respond to different evaluation contexts,
improve performance, and promote consistency and collaboration in your data analysis experiences.
Measures provide you with a magnifying glass that reveals the hidden information in your raw data.
This Introduction to DAX from Microsoft Learn will help you gain more insight into DAX measures.

Time intelligence functions

As a data analyst, one of your major responsibilities is to analyze data based on historical and predict
future performances as predictive modeling. Fortunately, DAX offers powerful functions that output
time intelligence in your calculations. In this lesson, you have studied and gained hands-on skills in
creating time intelligence measures using DAX. However, as you continue your Power BI analytical
journey, you will need to dig deeper into the more complex time intelligence functions that DAX can
offer. Microsoft Learn provides a comprehensive guide to time intelligence functions and their
syntax.

Conclusion

To become a certified Power BI analyst through the Microsoft PL-300 exam and conquer real-world
data challenges, you need to enhance your understanding of DAX, its logic, and its functions.
Remember, DAX has the power to uncover the hidden message in your data therefore, you must
continue exploring further resources related to modeling and DAX.

Activity: Adding a calculated table

Introduction

You should now have a good understanding of how to use DAX formulas and functions in Microsoft
Power BI to create calculated tables and columns. In this exercise, you will apply your knowledge of
DAX to add a calculated table to an existing dataset.

Scenario

Adventure Works' CEO needs a sales summary table containing annual sales amounts and quantities
sold for each country. The original sales table is a huge table with millions of rows representing
individual sales transactions. Using the DAX table functions you must create a calculated table
displaying the requested information only.

Instructions

Step 1: Download the Adventure Works sales file

 Download the Adventure Works Data.xlsx file and save it to your local computer. You need to
load the Excel data to the Power BI data model. The data model contains four tables: Sales,
Products, Salesperson, and Region. Power BI automatically establishes the relationships
between the fact and the dimension tables.

Adventure Works Data

XLSX File

Note: The dimension tables are related to the fact table via one-to-many relationships and a single
cross-filter direction.

Step 2: Clone the sales table

1. Adventure Works wants to perform analytical works on the Sales table but keep the original Sales
table unaltered. You need to create an exact copy of the Sales table. To do this, select New table
from the Home ribbon.
2. Write the following DAX code to clone the Sales table.

Sales (Cloned) = ALL(Sales)

3. Execute the code to add a new table named Sales (Cloned) to the model.
Step 3: Create a calculated table using DAX

1. As per Adventure Works requirements, you need to create a table containing the annual
sales summary for countries. You can use the DAX function SUMMARIZE table. You need to
include four columns in the summary table: Year, Country, Sales Amount, and Quantity sold.

2. Select New table from the Home ribbon of the Data view or Model view of Power BI and
write the following DAX expression.

Annual Sales Summary =

SUMMARIZE(Sales,

Sales[OrderDate].[Year],

Region[Country],

"Sales Amount (USD)", SUM ( Sales[Total Sales] ),

"Unit Sold", SUM ( Sales[Quantity] )


)

In the above expression:

 Sales is the original sales table of the data model.

 Sales[OrderDate].[Year] and Region[Country] are the group by columns, meaning the data is
grouped by the country and the year.

 Sales Amount (USD) is the name of the new column to be added to the table, followed by
the expression SUM ( Sales[Total Sales] ), which is summing the Total Sales column from the
original Sales table.

 Unit Sold is the name of second column to be added to the new table and is followed by the
expression SUM ( Sales[Quantity] ) that is aggregating the Quantity column of the original
Sales table.

3. Execute the code and note that a new table is added to the data model.
4. Thinking of a different way to compute the same calculated table? Can you use pre-calculated
measures instead of expressions? Yes, you can define measures for Sales and Units Sold for the Sales
table.

Sales = SUM (Sales[Total Sales])

Units Sold = SUM (Sales[Quantity])

Use them in the expression to calculate the Annual Sales Summary table as:

Sales Summary =

SUMMARIZE (

Sales,
Sales[OrderDate].[Year],

Region[Country],

"Sales Amount (USD)", [Sales],

"Unit Sold", [Units Sold]

Note: In the above DAX script, both SUM expressions are replaced by pre-defined measures Sales
and Units Sold, respectively. This DAX code produces the same results.

5. Note that the Sales Amount (USD) column displays the sales amount, but it looks unformatted.
Navigate to the Column tools and format the column as Currency with 2 decimal places.
Step 4: Save your project

 Apply all changes to your project, and make sure you provide an appropriate name and path
so that you can access the project for later use.

Conclusion

With these steps you have created a calculated table to display the Annual sales summary with user-
defined columns in the table, as per analytical requirements. You can leverage DAX power to create
calculated tables within your data model to fulfill business needs. Remember that when using DAX
expressions, you must ensure they are correctly formatted and that the column names match the
actual column names in your data.
Activity: Creating a report hierarchy

Introduction

You have gained a solid understanding of how to create a data hierarchy and how it helps in
navigating to the granular details of data through the drill-down functionality. In this activity, you will
learn how to create a hierarchical structure with various levels depending on the fields to help your
audience dig deeper into the information to make informed decisions.

Scenario

The Adventure Works sales managers need a report that displays the details of the location of sales
transactions. The visualization should present the data in a way that the manager can easily navigate
from country to individual postal code to track individual sales. On the other hand, they also want to
get sales information based on date dimensions, from an annual overview to daily sales values. You
need to visualize the sales data in both a geographical and date hierarchy.

Instructions

Step 1: Download the Power BI file

1. Download the Adventure Works Sales - Data hierachy.xlsx file and save it to your local
computer.

2. You then need to load the Excel file to the Microsoft Power BI data model.

Adventure Works Sales - Data Hierarchy

XLSX File

Note: In most cases, Power BI automatically establishes the relationships between the data tables,
but you need to make sure the relationships are accurate. The data model contains two tables;
FactInternetSales and Geography. The Geography dimension table is related to the Fact table via a
one-to-many relationship and a single cross-filter direction.
Step 2: Visualize the sales data with a geographical hierarchy

You need to create a geographical hierarchy to present the sales amount for each location. You can
use a map visual, such as Filled maps or Azure maps, but, for this activity, you can use a bar or
column chart. You can create the hierarchy by dragging and dropping fields into the chart axes, or
using the context menu.

Method 1: Create a geographical hierarchy by dragging fields

1. Select the Clustered bar chart from the Visualizations pane

2. Bring the Sales Amount field to the X-axis of the chart.


3. Create a geographic hierarchy by bringing the Country, State/Province, and City fields from the
Geography table to the Y-axis of the visual in the correct order. Remember to format the visual’s font,
color, and style.

Method 2: Create a geographical hierarchy by using the chart context menu

1. Alternatively, you can select More options, indicated by three dots beside the Country field from
the Geography table in the Data pane.
2. Select Create hierarchy from the drop-down menu. This action will create a Country Hierarchy.

3. Next, select the StateProvinceName field from the Data pane, select Add to hierarchy from the
drop-down list, and select an appropriate hierarchy where you want to add the field. In the current
exercise, you only have one hierarchy— Country.
4. Select the Country Hierarchy, and the field will be added as the second level of the hierarchy.
Repeat the process for City. A Country Hierarchy has been created, and you only need to bring the
entire hierarchy field to the visual.

Step 3: Drill-down into the data

1. On the top right side of the visual are arrows used for the drill-down functionality. To turn the drill
mode on, select the second down arrow.
2. You can now hover with your cursor over any data point, and a drill down and a drill up icon
appear in the tooltip. For example, hover with the cursor over the United States and select Drill
down. The visual automatically displays the sales values for the US states.

3. From here, you go further down the hierarchy. For example, hover with the cursor over Texas and
select Drill down to navigate to individual location sales within Texas.
Step 4: Visualize data with a date hierarchy

Next, you need to create a date hierarchy. Power BI automatically generates a Date Hierarchy when
you load a dataset containing a Date column.

1. In the current example, expand the OrderDate column of the FactInternetSales table from the
Data pane. Under the OrderDate, expand the Date Hierarchy to view the levels of the hierarchy. In
your visualization, you can use any number of levels from the Date Hierarchy.
2. You can create an individual visualization to display data based on the Date Hierarchy or create a
slicer with a Date Hierarchy. For this exercise, you need to create a slicer with a Date Hierarchy.
Select the Slicer visual from the Visualizations pane and bring the entire date hierarchy to the visual
field.

3. Select Vertical list from the Slicer Style drop-down. Note: There is a small arrow icon before each
year in the slicer.
4. Expand the arrow to view the next level of the hierarchy, which is Quarter 1, expand Quarter 1 to
view the next level, which is months, and so on.

5. You have now created a Date Hierarchy slicer where you can interactively visualize your data
based on both the geographical and date hierarchy.
Step 5: Save your project

 Make sure you apply all changes to your Power BI project and provide an appropriate path so
you can retrieve the file for later use.

Conclusion

Date hierarchy is a valuable feature of Power BI that lets your report users navigate to a deeper level
of information and enhance user engagement by introducing interactivity. With the steps outlined in
the exercise, you have created a visual with a geographic hierarchy and a slicer with a date hierarchy.
To excel as a Power BI developer and report designer, you should explore further to investigate what
other hierarchical structures are available in Power BI.

Activity: Add an Index Column

Introduction

Just like many interesting features in Microsoft Power BI, index columns can help in transforming
data in Power Query. You can identify each data row with a unique number, transform unstructured
data, or utilize this index column for writing efficient DAX queries.

In this activity, you will implement this feature in an unstructured dataset and convert it into a
structured one.

Scenario

Imagine you have received an unstructured dataset where all the data, including the column
headers, is contained within the same column one after another. Your team lead has requested that
you transform this data into a structured format suitable for creating data reports. Instead of asking
to regenerate this data, you will employ the powerful index column feature in Power Query to
transform it into a usable dataset.

Here is a view of the raw dataset before transformation:


And here is the dataset after the transformation using an indexed column.

Your task is to follow the instructions and correctly transform the data.

Instructions

Step 1: Open the Power BI file in Power BI Desktop

 Launch Power BI Desktop and open the file

Activity-Index-Column

XLSX File
It's normal to see no visuals at this stage; the data should be loaded correctly.

Step 2: Open Power Query

 Select the Transform data dropdown from the Home ribbon and select Transform data. This
action will lead you into the Power Query, where your data is prepared for transformation.

Step 3: Close the Query Settings pane

 To increase the visible data area, close the Query Settings pane.
Step 4: Add an Index column

 Select the Index column dropdown on the Add Column ribbon and select From 0. This will
add a new index column in your data model with sequential numbers starting from 0.

Step 5: Check the new indexed column

 A new indexed column appears in your data model with sequential numbers starting from 0.
Step 6: Add a Modulo column

1. You will now apply some transformation in this model to convert everything to a structured
data model. For this transformation, you need to add a new Modulo column.

2. Select the Standard dropdown in the Add Column ribbon and then select Modulo.

Step 7: Input number to calculate the remainder

1. In the new popup, input 3 because we have three column titles in our unstructured data,
Month, Order Quantity and Order Total.

2. Select OK.
Step 8: Check the new Modulo column

 A new column with remainders appears in your dataset which looks like the following
picture.

Step 9: Add another Divide column

1. To transform the dataset by pivoting, you need another helper column to indicate the
position of each row.

2. Select the Index column, then select the Standard dropdown in the Add Column ribbon,
select Divide (integer) and input 3.
Step 10: Check the new column

 A new column appears in the data model which looks like the picture below

Step 11: Remove the indexed column

You don’t need the indexed column anymore since you have the necessary data for transformation,
so let’s remove that column.

 Right-click on the indexed column header and select Remove.


Step 12: Pivot the data model

Now you can start your pivoting process.

 Select the Module column and then select the Pivot column from the Transform ribbon.

Step 13: Pivot column settings

1. In the new popup, select Data in the Values Column dropdown, and select Don’t Aggregate
in the Aggregate Value Function dropdown inside the Advanced options section.

2. Select OK.
Step 14: Check the pivot table

 Your data model will be transformed into the pivot table which looks like the image below.

Step 15: Remove the unnecessary columns

You don’t need the Integer-Division column anymore.

 Right-click on that column header and select Remove. This will remove the Integer-Division
column from your data model.
Step 16: Check the data model

 Now your data model looks clean and almost ready. It now looks like the picture below

Step 17: Promote the correct column headers

1. Notice that column headers in this data model show 0, 1, 2. You need to remove those
column headers and set Month, Order Quantity and Order Total as the correct column
headers.

2. Select the Table icon and select Use First Row as Headers.
Step 18: Check the final model

 When the first row is set as column headers, the data model will look like the image below:

Step 19: Apply the transformation

Now that everything looks as expected and the data has been transformed using an indexed column,
it’s time to apply the transformation.

 Select Close and Apply from the Home ribbon.


Conclusion

The Indexed column feature in Power Query is a valuable tool for transforming data into the desired
format, making it suitable for generating informative data reports. Additionally, this feature helps to
write efficient DAX queries. Understanding how to implement this feature is essential for becoming a
skilled data analyst.

In-depth: Implement a data model

Introduction

Calculated tables provide a way to visualize information that is not present in the imported data
which makes it a valuable addition to the data model. Creating hierarchical structures allows users to
explore deeper levels of detail and the Q&A feature allows business users to analyze information on
the go.

By completing this lesson, you’ve prepared for the data sources section of the PL-300 exam. If you’d
like to delve deeper into the topics you’ve covered in the Microsoft Power BI Analyst Professional
Certificate program, you can revisit the content in previous courses.

Calculated tables

Learn about the role of calculated tables and how to create summary tables using DAX logic in the
course Data Modeling in Power BI in week 2's lesson Introduction to DAX.

This will help you understand how to create a date dimension table based on DAX calculations to
enhance time intelligence measures in the lesson Time intelligence calculations in DAX.

In this week you will also discover how Microsoft Power BI allows you to duplicate a table, create
summary tables from DAX calculations, and even use measures to populate calculated tables in DAX
and table relationships. Finally you can explore the DAX library of table manipulation functions.

Data hierarchies

Navigation and filtering


In a report hierarchy, you can organize data in a visual to display information, from an overview to
specific details. You can cover this in detail in the course Data analysis and visualization with Power
BI. This is covered specifically in Report Navigation and Filtering.

For example, to visualize sales information based on location you can create a hierarchical structure
representing sales from continent level to the individual stores, depending on the data available in
the data model. You covered the details about how to create a report hierarchy as well as the drill
down functionality in the lesson.

Power BI Q&A feature

Getting access to real time data timeously is the most crucial aspect in today’s data driven
businesses. The Q&A feature of Power BI provides a way to get the desired information on the fly.
You can learn more about this in the course Data analysis and visualization with Power BI. This is
specifically covered in week 4's lesson Working with AI Visuals.

Learn how to write questions that Power BI provides answers to in the form of visuals via natural
language processing. Discover the key features of the Q&A visual and how you can teach Q&A to
better understand your business questions.

Conclusion

Enhancing the data model for better and clear visualization is the key in Power BI analysis. Creating
calculated tables using DAX logic, generating report hierarchies for drilling down to granular details
and Q&A visuals are some valuable features of Power BI that you must learn and master to
successfully complete the Microsoft PL-300 exam and to tackle real-world analytical challenges.

Additional Resources: Implement a data model

Introduction

You have further strengthened your understanding of data models and gained valuable insights
about the role of calculated tables, creating data hierarchies to analyze granular details of the data,
and the Q&A feature of Microsoft Power BI. Below are some useful resources you can explore to
enhance your knowledge of modeling and schemas.

Calculated tables

Calculated tables are the data tables you can generate within a data model by defining a DAX
expression. The calculated tables take data from the existing tables of the data model to display user-
defined information, for example, summary tables and date tables. You can also define a calculated
table to normalize a dimension table for a snowflake schema design. Microsoft Learn offers a
valuable guide about the use of calculated tables and the DAX table functions to enhance your
knowledge.

Data hierarchies

As a data analyst, you will often need to create a visual that not only provides an overview of the
information but allows users to drill down to view the granular details. You can do this by creating
data hierarchies in your Power BI reports. You have learned how to create hierarchies based on time,
geography, and products. You can consult this Microsoft Learn article about hierarchies to strengthen
your knowledge further and explore use cases of hierarchies.

Q&A visual
Power BI’s Q&A feature provides a robust tool to get valuable information as needed. Regardless of
data literacy of report users, this feature allows you to visualize critical data through natural language
processing. You can customize and teach Q&A terms, synonyms, and questions according to your
business needs. To further explore this feature, you can consult Microsoft Learn documentation
about the use of Q&A and how to Teach Q&A for a better understanding of business questions.

Conclusion

The three topics covered in the lesson, creating calculated tables, data hierarchies, and Q&A visuals,
are all valuable skill sets within your analytical toolkit. The Microsoft PL-300 exam evaluates your
skills on all these topics; making it invaluable to expand your understanding of data modeling and
business intelligence in Power BI.

Activity: Optimal data types and reducing data

Introduction

The performance of your data model is pivotal to the efficiency of your reports and dashboards. Two
key strategies for enhancing your data model performance involve thoughtful changes to the data
types and judicious removal of unnecessary rows and columns. In this activity, you will optimize an
Adventure Works dataset by changing data types, removing rows and columns, and optimizing
relationships where necessary.

Scenario

Adventure Works has a vast network of stores, an extensive product catalog, and thousands of sales
transactions. As the company endeavors to harness the power of data analytics, the need for model
performance optimization becomes evident. As the volume of data grows, the company is facing
sluggish reporting performance, which they need you to diagnose and fix.

Instructions

Step 1: Download the Adventure Works Sales file

 Download the Adventure Works Sales.xlsx file to your computer and load it to Power BI
Desktop. The dataset contains five tables in the data model: Sales, Products, Region,
Salesperson, and Date.

Adventure Works Sales

XLSX File
Step 2: Observe data and remove duplicates

1. Once you load the data, the first step is to inspect the data.

2. Navigate to the Data view and observe the records.

3. From the Data view, select the Sales table from the Data pane to display the details of sales
data. Here you can observe the records of individual columns. This will give you an idea of
the nature of the values and what the data types are. Note: You can select other tables one
by one from the Data pane to observe the records in all data model tables.
1. You also need to observe the key column of Sales for any duplicate records that will hinder
accurate data analysis. Select SalesOrderNumber column. The total number of rows and
distinct values are displayed at the bottom right corner of the interface. There are 57,851
rows but only 3,616 distinct values (order numbers). You need to remove the duplicates
because order numbers should not be repeated.

1. Select Transform data to open the Power Query Editor.


1. From the Editor, select the Sales table from the left-side Queries pane. Right-click the
SalesOrderNumber and select Remove Duplicates from the context menu.

1. Select Close & Apply to go back to the Power BI Desktop interface.

Step 3: Optimize the relationships

1. Navigate to the Model view of Power BI Desktop, where the graphical representation of the
data tables and the relationships between them is displayed. Observe that there is no
relationship between the Date table and the Sales fact table. This means you cannot create
any visualizations based on the Date table.
1. Establish a relationship between the Sales and Date table. You can do this either by dragging
the Date column from the Date table to the OrderDate column of the Sales table, or you can
select Manage relationships from the Home ribbon and create the relationship manually.

Step 4: Inspect and change data types

Appropriate data type is key to accurate and visually appealing visualizations. You can change or
update the data type of individual columns either from the Data view or the Model view of Power BI
Desktop. For the current activity, you can do this from the Data view.

1. Select the Sales table from the Data pane and select any column that takes you to the
Column tools. Ensure the data types for the following columns are:
o OrderDate: Date (Note: you need to select the date format)

o Unit Price: Currency with two decimal places

o Cost: Currency with two decimal places

o Total Sales: Currency with two decimal places

1. Next, select the Region table from the Data pane and make sure the Data category of the
following columns is set to:

o Continent for Group

o Country for Country


Step 5: Save your project

Your data model is now optimized for better performance by removing duplicates, updating the data
types, and managing relationships. In the context of real-life data applications where you’ll have
bigger and more complex datasets, optimization is the key to efficient performance.

 You need to save your Power BI project to your local machine or cloud, whichever you
prefer.

Conclusion

Optimizing a data model's performance is a strategic endeavor that involves fine-tuning both the
structure and content of your dataset. By meticulously selecting appropriate data types, managing
the relationship between data model tables, and eliminating unnecessary columns and rows, you can
create efficient and accurate reports and dashboards in the Power BI ecosystem.

Best practices for SQL data sources

Introduction

As a data analyst, you’ll often face the challenge of making sense of extensive datasets. One
approach might be to work with large SQL queries. However, this method is time-consuming and
prone to errors. A more efficient method is breaking SQL statements into multiple data sources.

This reading aims to assist you in understanding the importance of breaking SQL statements into
multiple data sources when querying multiple tables. By the end of this reading, you’ll understand
the critical role of adhering to best practices when working with SQL data sources, including early
data filtering and data aggregation in Power BI.

Best practices for SQL data sources

In Power BI, a well-structured query improves performance and enhances readability and
maintainability. Breaking complex SQL statements into multiple data sources is akin to modular
architecture in software design. It's about creating small, manageable, and reusable components.

Breaking SQL statements into multiple data sources when querying multiple tables in Power BI offers
several benefits that enhance the efficiency and effectiveness of data analysis. Let’s dive deeper into
some of the key advantages.

Improved performance

By breaking down a complex query into smaller, more manageable parts, you reduce the
computational load on Power BI. Each smaller query is quicker to execute and refresh, leading to
faster report generation and a more responsive experience for end-users.

Enhanced maintainability

When SQL queries are segmented, maintaining and updating the data model becomes easier. If you
need to modify or debug a particular part of the data model, you can do so without affecting other
parts. This modular approach is particularly beneficial in a team environment where multiple
analysts may work on different aspects of the same project.

Simplified troubleshooting

In case of errors or performance issues, it's easier to pinpoint the problem in a smaller, isolated
query than in a large, complex one. This simplification reduces the time and effort required for
troubleshooting.

Optimized data loading

By querying multiple tables separately, you only load the necessary data for each specific report or
analysis rather than loading a comprehensive dataset with unnecessary information. This selective
data loading helps manage data more efficiently in terms of storage and processing.

Customized data transformations


Different data sets might require different transformations. By breaking down SQL statements, you
can apply the most appropriate transformations to each dataset, ensuring that the data is in the best
format for analysis and reporting.

Adventure Works and SQL data sources best practices

Let’s explore some further, more detailed examples of best practices for SQL data sources by
exploring how Adventure Works can make use of them when creating its reports.

Segmenting datasets

Adventure Works must analyze a dataset covering sales, customer demographics, and product
details. The company might attempt a massive query, joining numerous tables in a traditional
approach. However, Adventure Works can also segment these sources with Power BI into distinct
queries: one for sales data, another for customer information, and a third for product details.

This segmentation makes each module of the data model more straightforward to update, debug,
and understand. For instance, if there's an issue with the sales data, it can be addressed
independently without disrupting the other modules.

This modular approach streamlines the data management process and sets a solid foundation for
efficient data filtering.

Data filtering

Data filtering is about minimizing the volume of data that Power BI needs to process. This practice is
not just a performance enhancer but also a resource management tactic. By filtering data at the SQL
source, you ensure that only relevant data is loaded into Power BI, reducing memory overhead and
improving report responsiveness.

For example, Adventure Works wants to analyze sales patterns over the last quarter. However, if the
company loads several years' worth of data into Power BI and then applies date filters, it’s needlessly
consuming resources.
Instead, Adventure Works should modify the SQL query to extract only the last quarter's data. This
focused approach speeds up report generation and simplifies the data model, making it easier to
work with and understand. The effectiveness of data filtering becomes even more noticeable when
it's paired with the use of data aggregation.

Aggregating data

Aggregating data at the SQL level can dramatically reduce the volume of data transferred and
processed in Power BI. This step is especially crucial when dealing with large datasets or when your
analysis only requires summarized data.

Adventure Works need to evaluate annual performance metrics. However, instead of importing
detailed transactional data into Power BI and performing aggregation, the company can evaluate its
metrics at the SQL level. Summarizing sales by year or average transaction values within SQL queries
speeds up the data import. It simplifies the data model in Power BI, allowing for quicker
development and easier interpretation of reports.
Conclusion

Remember, your role as a data analyst is not just about managing numbers; it's about uncovering
stories and empowering companies to make data-driven decisions. Each dataset you refine, each
query you optimize, and each insight you uncover contributes to the broader narrative of a
company’s success.

In-depth: Optimize model performance

Introduction

Diagnosing Microsoft Power BI report issues that hinder responsiveness and performing model
optimization is as important as creating reports and visually appealing visualizations. In this lesson,
you reviewed optimizing model performance, exploring diagnosing issues with the Performance
Analyzer, reducing cardinality, and creating aggregations as fixes. If you’d like to delve deeper into
the topics you’ve covered, the following lessons in previous courses from the Microsoft Power BI
Analyst Professional Certificate program provide additional details and insights.

By completing this lesson, you’ve prepared for the data sources section of the PL-300 exam. If you’d
like to delve deeper into the topics you’ve covered in the Microsoft Power BI Analyst Professional
Certificate program, you can revisit the content in previous courses.

Optimize performance in a Power BI model

Review the role of the Performance Analyzer and how to launch and record the performance of your
Power BI reports, data model health, and execution potential of DAX calculations in the course
Extract, Transform and Load Data in Power BI.

With the Performance Analyzer, you can record the entire execution of a report visual in real-time,
providing you with insight into the time taken by each query to execute or each visual to display on
the report canvas.

Optimization via cardinality and data types


Understand the various data types and how they can impact the performance of your data model
with in week 2 of the Extract, Transform and Load Data in Power BI course, specifically the lesson
Introduction to transforming data in Power BI.

Selecting the appropriate data type for each column and measure will assist you in the optimization
process. You have learned that correct data types not only help in the creation of insightful visuals
but are also of prime importance when working with cardinality. This was introduced in the course
Data Modeling in Power BI, previously in week 1's lesson Introduction to cardinality and cross-filter
direction, and establishing relationships between the data tables.

Create and manage aggregations

In week 3 of Data Modeling in Power BI you can learn about creating and managing aggregations.
Aggregation in Power BI is one of the most efficient techniques for data reduction during load. Take
some time to consolidate your conceptual understanding and gain hands-on skills in creating and
managing aggregations. This technique allows you to import only the summary tables instead of
large source data tables.

With the three storage modes available in Power BI, you can customize the storage of larger tables as
DirectQuery while smaller dimension tables can be imported to the Power BI memory to optimize
performance.

Conclusion

Optimizing data models and reports for user-friendly responsiveness requires identifying any issues
first. This identification leads you to the optimization operation. Power BI’s robust Performance
Analyzer tool and data reduction techniques equip you with the necessary gear to excel! Exam PL-
300 is a significant step towards becoming a certified and impactful Power BI analyst, which involves
mastering the skills covered in this lesson.

Additional resources: Optimize model performance

Introduction

In this lesson, you have gained a solid foundation in the significance of performance and efficiency of
Microsoft Power BI reports and the various techniques you can employ to optimize data models and
reports. Below are some useful resources you can explore to enhance your knowledge of
performance optimization.

Performance Analyzer

The Performance Analyzer in Power BI is a robust diagnostic tool designed to unveil the intricacies of
reports, data models, and query performance. It offers you a detailed view of the inner workings of
Power BI projects, shedding light on crucial metrics that impact your analytical work's responsiveness
and overall efficiency. It is helpful to consult additional resources about upcoming trends and
advancements in the tools and techniques of report diagnosis like this Performance Analyzer guide
by Microsoft Learn.

Data reduction techniques

In the real world, data analysts often must deal with large datasets originating from disparate
sources. It is not always advisable to import the entire dataset to the Power BI model for various
reasons. The Power BI ecosystem provides several techniques to reduce the amount of data loaded
into the model.
Reducing cardinality

Reducing cardinality is the technique that deals with selecting appropriate data types and importing
only the related columns to the model. You can consult Microsoft Learn's data reduction techniques
to enhance your understanding further.

Aggregations

Creating and managing aggregations offers another impactful technique for data reduction, where
you can create aggregated tables and group data by dimension tables. This technique provides a
summary table that is much smaller in size and reduces the volume of data you need to import.
Microsoft Learn offers a comprehensive guide on creating and managing aggregations in Power BI
and various storage modes that can help reduce your data.

Conclusion

The topics covered in the lesson are essential because creating reports and dashboards is pointless if
they are slow and non-responsive. Diagnosing reports with the Performance Analyzer and optimizing
your analytical workflow using various techniques in Power BI is key to ensuring a satisfactory user
experience.

Mark as completed

Like

Dislike

Report an issue

You might also like