You are on page 1of 17

Module 2: The Excel Data Model 18.10.

21, 17:23

Module 2: The Excel Data Model

Contents:

Module overview

Lesson 1: T Using an Excel Data Model Th


his is
do do
cu cu
Lesson 2: DAX me me
nt nt
No ca belo No c be
Lab: us annExcel
unExplore e gs Data Model un ause longs
au au
tho vr@g to R v
tho r@g to R
riz m i riz i
Moduleedreview a ste ed mail. ste C
co il.cand takeaways
Ch co c ha
pie om au
sh pie om us
sa ev. sa he
llo llo v.
we we
d! d!

Module overview

This module introduces two analytical tools available in Microsoft® Excel®: the Excel Data Model and Data Analysis
Expressions (DAX).
Th Th
is is
do d
The Excel Data Model cu enables you to include huge volumes of raw data fromoacurange of sources into tables in your
me m
familiar Excel environment.nt You can create relationships between these tables andenvisualize tb raw data as business
No c b e No c e
information. u n a u se l o n g s un ause longs
au au
tho vr@g to R tho vr@g to R
riz m i riz i
ed ail
.co
s te
Ch ed mail. ste C
DAX provides a formula language, co similar to
a the formula in Excel, though more powerful cand
o co
streamlined ha in how it can
pie m us pie m us
sa he sa he
manipulate data, because it is designed llo especiallyv. for this purpose. l low v.
we e
d! d!

Objectives
After completing this module, you will be able to:

• Describe the Excel Data Model and its use.


Th Th
• Use DAX toiscreate
do simple data analysis formulas. is
do
cu cu
me me
nt nt
No ca b elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R
Lesson 1: Using an Excel Data Model
riz
ed mail. ste C
i ori
ze
gm Ris
a te
co c ha d co il.com Cha
pie om us pie us
sa he sa he
llo v. l l o v.
The Excel Data Model, which includes wethe PowerPivot add-in, enables you to integrate data fromwmultiple e tables, so
d! d!
that you can build a relational data source inside your Excel workbook. Before looking at the Excel Data Model, you
need to understand the term “data model”. To explain the structure of a data model, you need to understand tables,
and relationships between tables.

In this module, you will see how to create an Excel Data Model, and manage its tables and relationships.

Th Th
is is
Lesson objectives
do
c
do
cu
um me
en nt
After completing t b you will be able to:
No this c lesson, e No ca belo
u n a u se l o n g s un us
e ng
s
au v au
tho r @
g
to
Ris tho vr@g to R
riz Model riz i st
• Describe the Excel Data ed mail. and te its use. ed m a e
co c Ch co il.com Cha
pie om au
sh pie us
sa ev. sa he
• Explain the role of tables in the data llo model. llo v.
we we
d! d!
• Create relationships between tables using keys.

• View an Excel Data Model.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 1 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

What Is an Excel Data Model?

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au v
tho r@g to R tho r@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co c ha co c ha
pie om us pie om us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
N c b el No c be
Data Models o un ause ongs un ause longs
au v a uth vr@
tho r@g to R ori gm Ris
to
rizassociated ist relational databases, such as Microsoft SQL
Data models are usually ed mail. with eC zeServer®
dc a i t
l.c ande Microsoft
c co ha om Chau
Access®. A model describesopthe m
ies relationship us between data tables. For example, a business
he
op has
i e a databasesh table for
all sa e.
sales (SalesTable) that holds information ow aboutv.all sales, such as Order Number, Sales Period, lSales low Value,vSales
ed ed
Outlet, Customer Id, and so on. A second ! table holds all the information about customers (CustomerTable), ! such as
the Customer Id, Customer Name, Customer Address, and Region. There is a customer for each sale, but the
business doesn’t want to hold duplicate details about the customer (name, address, telephone number) with every
sale. This would mean holding a large quantity of repetitive data and would almost certainly lead to data
inconsistencies. To avoid this, a relational database establishes a relationship between the two tables. Every sale has
a customer id, which relates to the customer id in the CustomerTable. This means that all the customer information
is held only Tonce
his in one table. When an employee wants to report on allTthe his customer purchases, the data model lets
do
them combine information
cu from the related tables, so that their report showsdoacurecognizable customer name for each
me me
nt
sale, rather than a customer number that’s difficult to remember. nt
No ca belo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R
This simple model has rtwo ize tables m that is are connected by a one-to-many relationship; ze m Ris can make many
ori onegcustomer
d c ail.c te Ch d c ail.c te Ch
purchases. A data model canopbecome o far amore us complex, with 10s or 100s of related tables. op o au
ies m he ies m sh
all v. a llo ev.
ow we
ed d!
The Excel Data Model !

The Excel Data Model is Excel’s implementation of the data model concept. Instead of having all your data in sheets
in a workbook, you can access the data by including it in the workbook's data model. This may seem like the same
thing, but the data model offers built-in analysis functionality—this means that the data available for you to analyze is
no longer limited to the number of columns, rows, and sheets that you can have in an Excel workbook. In Excel 2016,
you can create data models that contain millions of rows, against which you can perform data analysis.
Th Th
is is
do do
cu cu
You can create a model me by importing data from a variety of sources by using several
me tools, including:
nt nt
No ca b elo No ca belo
un us n gs u na u s ng
e uth evr@ s to
• Excel tables autho vr@ to
R
riz g i ori gm Ris
ed mail. ste C ze a te
co c ha d co il.com Cha
• PowerPivot pie om us pie us
sa he sa he
llo v. l l o v.
we we
• Power Query d! d!

• Table import wizard

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 2 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Some of these sources, such as Power Query, completely bypass the Excel worksheet and load data directly into the
data model.

The data model itself is not visible in standard Excel worksheets. To see the data in Excel, you need to use
PowerPivot.

Tables in an Excel Data Model


Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au v
tho r@g to R tho r@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co c ha co c ha
pie om us pie om us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au
tho r@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co co ha co co ha
pie m us pie m us
sa he sa he
llo v. llo v.
we we
d! d!

Excel users should be familiar with tables. However, table is a term commonly used for several different structures in
Excel. Columns and rows of data are generally called tables, but they are not strictly tables. A block of data is only an
Excel table if it is formatted as a table. You do this by selecting the block of data, clicking Table on the ribbon, and
then clicking OK, to create the table. Excel gives the table a default, sequential name, such as Table1, Table2, and so
Th change this name in the Table Name option on the TableTTools
forth. You can
his
ribbon.
is
do do
cu cu
me m
A table like this is limitednt by the Excel worksheet size of 1,048,576 rows by 16,384encolumns. t This may seem big in
No ca b elo No ca belo
workbook terms, unbut itusis smalln gsfor a database, which may hold many millionsu of
na rows
u s of data,
n g such as historical sales
au e uth evr@ s to
going back for years. tho vr@g to R ori gm Ris
riz i
ed mail. ste C ze a te
co c ha d co il.com Cha
pie om us pie us
The data model has new types of s atables, which he you can only see by clicking Manage Data Model sa on thehData
ev. or
llo v. l l o
we we
Power Pivot ribbons. This command opens d! a new window and shows the tables currently in the workbook’s d! data
model.

Note: Note: a workbook can only have one data model. The data model may contain multiple tables.

Th Th
This looks like isthe Excel table, but the values cannot be edited directly. That
is is done in the Excel worksheet.
do do
cu cu
me me
nt nt
No hasctwo b e N b
The data model typesl
u n a u se o n g s
of tables: ou c au elon
au n au s e gs
tho vr@g to R tho vr@g to R
riz m i s te rize m is
• Fact tables ed a
co il.com Cha d c ail.c te Ch
pie us o pie o m au
sa he sa sh
llo v. llo ev.
• Dimension tables we we
d! d!

Fact Table

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 3 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Fact tables store quantitative data for analysis or reporting. In our example, the SalesTable is a fact table. It holds
information on the individual sales, but it does not hold detailed information on the customers, beyond the Customer
Id, which is the foreign key to the CustomerTable.

Dimension Table

A dimension table holds descriptive data (or attributes) that enable an analyst to slice and dice the data in the fact
table. By using the information in the CustomerTable, the data in the fact table can be grouped by Region.
Th Th
is is
do tables, you can (and should) name tables for ease of use.
Like standard Excel do Traditionally, a fact table is preceded
cu cu
me me These tables would be named
by the word “Fact” or an nt “f” while dimension tables are preceded by “Dim” or a “d”.nt
N b e N b
FactSalesTable o uandcaDimCustomerTable.
u lon o u cau elon
na s e g s na se gs
uth v r to uth v r to
ori @gm Ris ori @gm Ris
ze ze
d c ail.c te Ch d c ail.c te Ch
Relationships in an oExcel pie om Data au Model op
ies m
o au
sa sh sh
llo ev. all ev.
we ow
d! e d!

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au
tho r@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co co ha co co ha
pie m us pie m us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
RelationshipsNdescribe howb one table relates to another. For example, if you
No have ca a tablebe that lists sales (fSalesTable)
o u cau elon u u lon
and another that nlists se
au customers g s (DimCustomerTable), you need a n
corresponding sfield
e gs
(column)
th v r @ to a u tho v r@ to in each that links
Ris gm Ris
them. In the slide, theolinking
riz gfield
m is CustomerID.
te This is because it exists in both r
tables.
i ze
ed a
co il.com Cha d c ail.c te Ch
op o au
pie
sa
us
he ies m sh
l v. a llo ev.
There are three types of relationship: low we
ed d!
!

• One-to-many. This describes a relationship between two tables where one table has a unique field (cell) in a
record (row) that can relate to multiple records in another table. In our example, DimCustomerTable.CustomerID
has a one-to-many relationship with fSalesTable.CustomerID. This is because one customer can place many
orders.

Th Th
is is
do do
cu cu
me me
• One-to-one. This means
nt that there can only be one occurrence of the field in one nt record, in each table. This is the
No ca b elo No ca belo
least common us
undatabase relationship,
n g because the fields could be in one table.
u na u
Most
s often,
ng this type of relationship
ev uth evr@ s to
au
th r@ s to
is imposed because oriof business
gm R irule. riz g Ri
In this example, the relationship betweenofSalesTable.OrderNumber and
ze
d c ail.c te Ch
s ed mail. ste C
DimCustomerTable.OrderNumber op om is auone-to-one relationship. co co h a
ies sh pie m us
all ev. sa he
ow llo v.
ed we
! d !
• Many-to-many. This relationship describes a situation where many records in one table can relate to many
records in another. For example, many customers can purchase many products—related by
DimCustomerTable.ProductId and DimProductTable.ProductID.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 4 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Tables are related by key fields. Each table has a primary key field and, where you want a unique relationship
between tables, this relates to another table through a foreign key field.

Primary Keys

When you start working with large amounts of data, it is important to make sure that there are no duplications. For
example, the Thbusiness needs to be sure that every sale is unique. If this Tish not the case, then duplicate sales could
is is
occur, which woulddo make all business analysis uncertain, at best—or wrong, doat worst. To do this, the FactSalesTable
cu cu
me me so there cannot be duplicate
has a unique entry for eachnt sale; the OrderNumber. Each order number is unique, nt
N b e N b
c
un athe
orders. This is ocalled lon
us primary key of the FactSalesTable. o u cau elon
ev g s na se g
au
tho r@g to R uth v r@ s to
riz i o riz g Ri
Foreign Keys ed mail. ste C ed mail. ste C
co co h au c op c o ha
pie m sh ies m us
sa e all the he
It is also important to ensure that there llo is a unique v. relationship between tables. In our example, ow v.
we e
d !
DimCustomerTable has a primary key of CustomerId. This is used in the FactSalesTable to identify customers, but d !
it cannot be the primary key in the FactSalesTable, because a customer can make multiple purchases. In the
FactSalesTable it is a foreign key, because it uses the primary key from another table (DimCustomerTable) to relate
to information in the DimCustomerTable.

Demonstration: Viewing Data in an Excel Data Model


Th Th
is is
do
In this demonstration, do create relationships between them.
cu you will see how to create a data model, view tables, and cu
me me
nt nt
No ca b elo No ca belo
Demonstration u u
na stepss n g u na u s ng
uth evr@ s to uth evr@ s to
ori gm Ris ori gm Ris
ze te ze
d ail
. Ch d c ail.c te Ch
1. In the factSalesTable csheet, op coclick auA1. op o au
ies m cell sh ies m sh
all ev. a l ev.
ow low
2. On the ribbon, click Insert, then click e d! Table. e d!

3. In the Create Table window, accept the default options and click OK.

4. On the ribbon, in the Properties section, highlight Table1 and type FactSalesTable, and then press Enter.

5. Repeat steps 1 to 4 for the following sheets, replacing the default table name with the title of each sheet:
Th Th
is is
do do
cu cu
me me
nt nt
• DimCustomerTable
No ca b elo No ca belo
un us n gs u na u s ng
au ev uth evr@ s to
r t
• DimRegionTable thori @gm o Ris ori gm Ris
ze ze
d c ail.c te Ch d c ail.c te Ch
op o au op o au
• DimProductTable ies m sh ies m sh
all ev. a llo ev.
ow we
ed d!
• DimProductCategoryTable !

• DimProductSubcategoryTable

6. Click the factSalesTable tab.


Th Th
is is
7. do click Insert, and then click PivotTable.
On the ribbon, do
cu cu
me me
nt nt
8. No b e
cPivotTable N c be
In the Create l
u n a u se o n g s window, select the Add this data to the Data
ou Modelau check lon box, leave other options
au n a s e gs
v
thoand @r toR u v r@ to
at their defaults,
riz gm OK.
click
i s
tho
rize g m Ris
ed ail te d a i te
co .c o C ha co l .co Ch
9. In the PivotTable Fields ies m scroll
pwindow, us the Choose fields to add to report list. Note: pieonly au
mthe FactSalesTable
h s sh
all ev. a llo ev.
columns are available. ow we
ed d
! !
10. On the ribbon, click Data and then click Manage Data Model.

11. In the Microsoft Excel dialog box, click Enable. Note: the FactSalesTable data is now in the data model in the

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 5 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Power Pivot for Excel - Mod2_Demo1.xlsx window.

12. Select the Mod2_Demo1.xlsx - Excel window.

13. In the PivotTable Fields window, click All and scroll the Choose fields to add to report list. Note: all the
tables and their columns are available, but only FactSalesTable is active. Other tables only become active when
one or more of their columns is being used in the PivotTable.

14. Navigate to the Power Pivot for Excel - Mod2_Demo1.xlsx window. Note: only the FactSalesTable is in the
Th Th
model. is d is
do
oc cu
um me
en nt
15. t
No Mod2_Demo1.xlsx
Select the c b e - Excel window. N o u cau elon
b
u n a u se l o n g s na se g
au v
t o r@g to R uth v r@ s to
16. Click the sheet hdimCustomerTable,
riz i click anywhere in the table, then, on the o ribbon,
riz g clickRiPower Pivot, and
ed mail. ste C ed mail. ste C
c c h c op cowindow, ha the
then click Add to DataoModel. pie omNote:auins the Power Pivot for Excel - Mod2_Demo1.xlsx ies m us
sa he all he
DimCustomerTable is now part llo of the data v. model. ow v.
we e
d! d!
17. On the Power Pivot for Excel - Mod2_Demo1.xlsx window ribbon, click Diagram View. The two tables are in
the diagram of the model. Note: there is no relationship between them.

18. Click and hold CustomerKey in FactSalesTable and drag it to CustomerKey in DimCustomerTable. Note: a
one-to-many relationship (one denoted by a 1 and many denoted by an *) is created. That means that one
customer can make multiple purchases.
Th Th
is is
do do
19. Repeat stepscu14meand 15 for the following tables: me
cu
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au
tho r@g to R tho vr@g to R
r i riz i
• DimRegionTable ized mail. ste C ed mail. ste C
co co ha co co ha
pie m us pie m us
sa he sa he
• DimProductTable llo v. llo v.
we we
d! d!
• DimProductSubcategoryTable

• DimProductCategoryTable

20. Repeat
Thstep 17 to create the following relationships: Th
is is
do do
cu cu
me me
nt nt
No ca b elo No ca belo
u na u s
• DimRegionTable[GeographyKey] n g to DimCustomerTable[GeographyKey] u na u s ng
uth evr@ s to uth evr@ s to
ori gm R is ori gm Ris
ze ze
• DimProductTable[ProductKey] d c ail.c toteFactSalesTable[ProductKey]
C ha d a
co il.com Cha
te
op o
ies m us
he
pie
sa
us
he
all v. l l v.
o
• DimProductSubcategoryTable[ProductSubcategoryKey]
we to DimProductTable[ProductSubcategoryKey] o we
d! d!
• DimProductCategoryTable[ProductCategoryKey] to DimProductSubcategoryTable[ProductCategoryKey]

21. In the Diagram View, click the relationship line between FactSalesTable and DimProductTable. Note: the
related columns are highlighted.
Th Th
is is
do do
22. Close Excel cwithout
um saving changes. cu
me
en nt
tb
No ca elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
Lesson 2: DAX ed mail. ste C ze a te
co c ha d co il.com Cha
pie om us pie us
sa he sa he
llo v. l l o v.
we we
The power of the Excel Data Model is truly d d
! realized when you start to use DAX to manipulate the raw! data. DAX is a
formula-based development tool, similar to the formulas that you might develop in Excel. However, DAX is designed
to manipulate data, so it provides powerful and flexible functions to work with the data in a data model.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 6 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

In this lesson, you will see how you can use DAX to create different types of formulas in the Excel Data Model and
how DAX functions, based on the context in which it is used.

Lesson objectives
After completing this lesson, you will be able to:

• Describe the features of DAX.


Th Th
is is
do
• Explain the importance of context for a DAX formula. do
cu cu
me me
nt nt
be be
• List someNof o uthe ccategories lo of DAX formulas. No c
a
n a u se v n g s un ause longs
uth to au v
ori
r@
gm Ris tho r@g to R
riz i
• Create simple DAX formulas. ze
d c ail.c te Ch ed mail. ste C
o co c ha
op
ies m au
sh pie om us
all ev. sa he
ow llo v.
ed we
! d!
Introduction to DAX

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au
tho r@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co co ha co co ha
pie m us pie m us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
No ca b elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
ed mail. ste C ze a te
Data Analysis Expressions (DAX) co c
is a formula
ha language, rather than a programming language. d co il.cThis Ch
makes
au it familiar in
pie om us pie om sh
appearance—and its use—to Excel s h
all formulas. It evprovides functions, operators, and constants s that
a combine evto
ow . llo .
ed we
develop formulas, or expressions, to create ! new values from the data in the Excel Data Model. DAXdformulas ! are
similar in appearance to standard Excel formulas; however, Excel formulas use cell references while DAX acts on
entire columns. You type the DAX formulas into the Power Pivot view of the table, and the calculation is applied to
the entire column; there’s no need to copy down the formula. To achieve this, DAX has its own syntax.

You create DAX formulas in the Power Pivot screen. To see this, click Power Pivot on the ribbon, and then click
Manage. The Th screen that appears looks like a single screen, but it is, in Tfact, split into two areas—the Calculation
i his
Area (top) and sthe
do Values Area (bottom). do
cu cu
me me
nt nt
No b elo No b
You can use DAX
ca
unto create
us two
n type of formulas: u
c au elon
au e g s n au s e gs
tho vr@g to R tho vr@g to R
riz m i s te rize m is
e
• Calculated columns d co l.com Cha
ai d c ail.c te Ch
pie us o pie o m au
sa he sa sh
llo v. llo ev.
• Measures we we
d! d!

Calculated Columns

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 7 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

The formulas that you just looked at are examples of calculated columns. This means that you have created a new
column in your data model, which is called CalculatedColumn1. You can rename this, perhaps to [Profit] and use it in
other calculations and data analysis.

Calculated columns are created in the calculation area of the Power Pivot screen.

Syntax

The DAX syntax—the


Th structure of the formulas—for a simple expressionTis as follows:
is his
do do
cu cu
me me
nt nt
No b e N b
c
u n a u se l o n g s
=[ListPrice]-[ProductCost] o u cau elon
na se g
au v
tho r@g to R uth v r@ s to
riz i o riz g Ri
ed mail. ste C ed mail. ste C
co co h au c op c o ha
pe m ies m us
This expression is designed to ifind s a the profitshon
e an item—the sale price minus the cost of production.all he
llo v. ow v.
we e
d! d!
This breaks down as follows:

• Each formula begins with an equal sign (=) and this is followed by a reference column. The column name is
surrounded by square brackets, such as [ListPrice].

• Then comes an operator, such as any of the usual mathematical operators (+, -, /, *). There follows another
Th Th
referenced iscolumn
do that contains the data that you need to complete the is calculation. This is a very simple
do
cu cu
m
calculated column,ebut there are far more complex and powerful examples. me
nt nt
No c b e No c be
u n a u se l o n g s un ause longs
au v a uth vr@
tho r@g to R ori gm Ris
to
riz ma ist ze a te
Measures e dc i l. e Ch dc i l. Ch
o p co m au op com au
ies sh ies sh
all e v a eMeasures
v.
The bottom section of the Power Pivot ow screen is . called the Values Area, and is used to develop l measures.
low
ed ed
are calculations used for data analysis. These ! can include familiar Excel calculations, such as SUM, AVG, ! COUNT,
and so forth. You can also use more advanced calculations by using DAX formulas.

Syntax

The syntax of a measure is as follows:

Th Th
is is
do do
cu cu
me
TotalSalesAmount:=SUM(fSalesTable[SalesAmount]) me
n tb nt
No ca elo ca belo No
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz
The elements of this measure ail iste C
ed mare: ze a te
co .c ha d co il.com Cha
pie om us pie us
sa he sa he
llo v. l v
• TotalSalesAmount: This is the name we of the measure. Note that a measure name is followed by l o wea colon (:).. This
d! d!
name can be used in other DAX formulas, including those in calculated columns.

• = The equal sign shows that this is the beginning of the calculation formula, just like in Excel.

• SUMThis is the function that will be used—in this case, the measure will add up the items in the SalesAmount
column of the fSalesTable table.
Th Th
is is
do
• (…)The parentheses surround measure arguments, just as you see in do
standard
cu cu Excel formulas.
me me
nt nt
No be N b
• fSalesTableThis cis the name
l
u n a u se o n g s of the referenced table; in this case, fSalesTable.
ou c au elon
au n au s e gs
tho vr@g to R tho vr@g to R
• [SalesAmount]This iis r m i s rize m inisthe fSalesTable
d c ail.c te Chcolumn in the table; in this case, it is [SalesAmount]
zethe referenced
d c ail.c te Ch
o o m
pie qualified a o pie om au
table. This is known as a fully column
us
he name. sh
sa v sa ev.
llo . llo
we we
d! d!

Implicit and Explicit Measures

There are two types of measures:

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 8 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

• Implicit

• Explicit

An implicit measure is created by Excel automatically, when you drag a field to the Values area of the PivotTable
Fields window in an Excel sheet. You may not even realize that a measure has been created by Excel, but, if you look
at the Value list, you will see that the field that you dragged to the Values list is now prefixed with “Sum of”. If the field
you draggedThwas
is called OrderQuantity, it would now be called Sum of OrderQuantity.
Th
do is
do
cu cu
me me
An implicit measure n
only t uses the following aggregation options: Sum, Count, nt
Average,
No b e N b Max, Min, StdDev, StdDevp,
u
ca
u lon o u cau elon
Var, Varp, and Distinct
na s
Count.
e g
You
s can change the aggregation by right-clicking na thesfield
e g
name in the Values list and
uth v r@ to uth v r@ s to
o
selecting Value Field Settings.
riz g m R i s o r g m Ris
ed a te i z ed a te
co il.com Cha co il.com Cha
pie us pie us
sa he sa he
An explicit measure is created when lloyou type a vformula
. into a cell in the Calculation Area, or by llousing AutoSumv. in the
we we
Power Pivot window. d! d!

Context of Calculations

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au
tho r@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co co ha co co ha
pie m us pie m us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
No ca b elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
ed mail. ste C ze a te
co c ha d co il.com Cha
pie om us pie us
sa he sa he
llo v. l l o v.
The concept of context is important when we you work with DAX formulas. There are two types of context: we
d! d!

• Row context

• Filter context

Th Th
Row Contextis do do
is
cu cu
me m
Row context refers to the nt current row. The example of a column calculation in the eprevious
nt topic was:
No ca b elo No ca belo
un us n g u n u s ng
au e s au e s
tho vr@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
=[ListPrice]-[ProductCost] co co h a c o co ha
pie m us pie m us
sa he sa he
llo v. l l o v.
we we
d! d!
The values for each row in the table were calculated from values in the two columns ListPrice and ProductCost. The
column calculation then acts on each row in the table. The row context also applies when a formula function applies
filters to identify a row in a table. The function applies a row context for all rows in the table.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…b-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 9 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Filter Context

A filter context describes the filters applied in a calculation. This is in addition to any row context that exists. These
can be applied in the PivotTable Fields window, by adding field items to options, such as Filters.

In the example, the column calculation =[ListPrice]-[ProductCost] can be further filtered on other columns, such as
SalesYear or SalesRegion. If a filter for SalesYear is applied, the result of the calculation is shown by the year of the
sale (2010, 2011, and so on). As well as adding filters by column or through Power Pivot slicers, you can add filters in
DAX formulas.
Th You can do this by creating a measure that uses a function Th (ALL, RELATED, FILTER, CALCULATE,
is
relationship, measure or column) to define a filter. is
do do
cu cu
me me
nt nt
N b e N b
c
u n a u se l o n g s
Filter contextoexample o u cau elon
na se g
au v
tho r@g to R uth v r@ s to
As an example of this, ryou is o g Ri
ize needm to create a filter context for sales regions in your model.
riz The measure
ed mail. ste C
looks like this:
d c ail.c te Ch c c ha
op om a us o p o m us
ies he ies he
all v. all v.
ow ow
ed ed
!
SalesRegion:=CALCULATE([TotalSalesAmount],DimRegion[SalesRegion]=”NortWest”) !

Some of the syntax was covered in the previous topic, so the explanations for these elements are brief. The syntax is
as follows:

Th
• SalesRegion: Th
is The measure name. is
do do
cu cu
me me
• = The start of the formula.
nt nt
No c b e No c be
u n a u se l o n g s un ause longs
• CALCULATE The a v
uthfunction.
r to a uth vr@ to
ori @gm Ris ori gm Ris
ze a i te ze a i te
dc l. Ch dc l. Ch
• (…) The parentheses. o p co m au op com au
ies sh ies sh
all e v. a l ev.
ow low
• [TotalSalesAmount] This is the measure e d! e d!
(TotalSalesAmount) created in the last topic.

• ,Commas are used to separate filters.

• Dim Region[SalesRegion]=”NortWest” This defines a referenced column (DimRegion[SalesRegion]) with a


specified value; in this case, ‘NorthWest’.

Th Th
is is
do do
cu cu
The filtering imposedmeby nt this formula means that margin values defined by the me
TotalSalesAmount
nt measure are
b be
calculated forNothe
un
ca
entries
u inelothe column SalesRegion in the table DimRegion
n
No that ca have
u l a
onvalue of ‘NorthWest’.
un
au sevr@ gs to au sevr@ gs to
tho gm R th ori gm Ris
riz ail iste C ze a te
Examples of DAXedFormulas co .
pie om
c ha
us
d co il.com Cha
pie us
sa he sa he
llo v. l l o v.
we we
d! d!

Th Th
is is
do do
cu cu
me me
nt nt
No c be No ca belo
u n a u se l o n g s un us
e ng
s
au au
tho vr@g to R tho vr@g to R
riz i riz i st
ed mail. ste C ed m a e
co co
m ha co il.com Cha
pie us pie us
sa he sa he
llo v. llo v.
we we
d! d!

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 10 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Th Th
is is
do do
cu cu
me me
nt nt
No c be No c be
u n a u se l o n g s un ause longs
au v au v
tho r@g to R tho r@g to R
riz i riz i
ed mail. ste C ed mail. ste C
co c ha co c ha
pie om us pie om us
sa he sa he
llo v. llo v.
we we
d! d!

Th Th
is is
do do
There are more than cu 200 functions available for use in DAX formulas. cu
me me
nt nt
No ca belo No c be
u na u s ng un ause longs
uth evrthese
For ease of identification, s are
to categorized as follows: au
tho vr@g to R
ori @gm Ris riz i
ze
d c ail.c te Ch ed mail. ste C
om co co ha
• Date and Time Functions opie au
sh pie m us
he
sa ev. sa v.
llo llo
we we
• Time Intelligence Functions d! d!

• Filter Functions

• Information Functions

• Logical Functions
Th Th
is is
• Statistical Functions
do do
cu cu
me me
nt nt
• Text Functions
No ca b elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
ed mail. ste C ze a te
co c om ha d co il.com Cha
There are also more specialized pie DAX formula us categories for Mathematics and Trigonometry, pie Parent/Child, us and Other
sa he sa he
l l o v. l l o v.
(miscellaneous) functions. we we
d! d!

Here are examples and explanations of some of the commonly used DAX formulas:

• Date and Time. These are similar to the date and time functions that you might already have used in Excel,
although they are based on SQL Server date/time data types.Example: DATE
Th Th
is is
do do
cu
=DATE(2016,7,25) cu
m en me
tb nt
No ca elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
This returns the daterizJuly 25, 2016.i
ed mail. ste C ze a te
co c ha d co il.com Cha
pie om us pie us
• Time Intelligence. These functions sa createhformulas
ev. that combine time and date ranges with s a aggregations he or
v.
llo l l o
we we
calculations. This means that you can d! develop comparisons across different time periods.Example: d!
DATESBETWEEN

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 11 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

=CALCULATE(SUM(FactSales[SalesAmount]), DATESBETWEEN(DateTime[DateKey], DATE(2016,6,1),


DATE(2016,8,31)))

This calculates the SalesAmount in the FactSales table between the dates June 1, 2016 and August 31, 2016.

• Filter. You have already seen a filter function (CALCULATE) in action. This function lets you return data types, look
up valuesThin related tables, and filter by values in related tables to provide Th filter context.Example: DISTINCT
is is
do do
cu cu
me me
nt nt
N b e N b
o u cau
=COUNTROWS(DISTINCT(InternetSales_USD[CustomerKey]))
lon o u cau elon
na s e g s na se gs
uth v r to uth v r to
ori @gm Ris ori @gm Ris
ze ze
d c ail.c te Ch d c ail.c te Ch
This counts the number ofopunique o au op in othe au Sales USD
ies m customers sh (CustomerKey) who have generated orders ies m Internet sh
a l ev. a l ev.
table. l ow l ow
ed ed
! !
• Information. You use information functions to check whether the table or column that you provide as an
argument to another function returns a value that matches the expected type. Example: CONTAINS

=CONTAINS(InternetSales, [ProductKey], 214, [CustomerKey], 11185)

Th Th
is is
do do
c um
This creates a calculated measure that tells you whether there were any Internetcu
en me sales of the product 214, and to
t nt
customer N11185,caat the besame time. No ca belo
ou u lon u u ng
na s g na s
uth evr@ s to uth evr@ s to
o
• Logical. Logical functions
riz g R o
returni information about values in an expression. Example:riz gIF Ri
ed mail. ste C ed mail. ste C
co co ha co c ha
pie m us pie om us
sa he s all he
llo v. o v.
w
=IF([OrdersPerDay]<200,"low",IF([OrdersPerDay]<300,"medium","high"))
ed w ed
! !

This creates a calculated measure that tells you whether the orders on a given day were “high” (300+), “medium”
(299-200), or “low” (<200).

• Statistical. These functions perform aggregations, such as sum, average, minimum, and maximum. Example:
AVERAGE Th Th
is is
do do
cu cu
me me
nt nt
N b e N b
o un
c a us l on
=AVERAGE(FactInternetSales[SalesAmount]) o u
c au elon
ev gs na se g
au
tho r@g to R uth vr@ s to
riz m i s ori gm Ris
te ze
ed a
co il.com Cha d c ail.c te Ch
pie mean of the us numbers in the column [SalesAmount] in the op om au
This calculates the arithmetic sa he ieFactInternetSales
sa sh table.
llo v. l ev.
we l o we
• Text. The text functions, like Excel text d! d!
functions, enable you to return text within a string, or concatenate string
values. You can also use the FORMAT function to format values, such as dates, times, and numbers.Example:
FIND

his T T
=FIND(“Mountain Bike”,”Line of Mountain Bike accessories”)his
d oc d oc
um um
en en
tb t
No ca elo No ca belo
u
This finds the position uof n
se the first
g letter of the product designation, Mountainu Bike, uin
s nstring
g
na
uth vr@ s to
n au
t
e vthe
r@ s to
that contains the
R h gm Ris
product description. oriz gm i s te
ori
ze
ed a
co il.com Cha d c ail.c te Ch
op o au
pie
sa
us
he ies m sh
v a ev.
DAX Function Reference llo
we . llo
we
d! d!

https://aka.ms/r2g54l

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 12 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Demonstration: Working with DAX


In this demonstration, you will see how to create and use calculated columns and measures with DAX.

Demonstration steps
View a Data Model

1. Click Enable
Th Editing, and then click Enable Content, should these Thnotification messages appear. Note: the
is is
d
workbook appears empty. This is because the data has been importeddofrom
oc
um cu SQL Server directly into the data
en me
model. tb nt
No e N b
c
u n a u se l o n g s o u cau elon
au na se gs
2. v r@ to then click Manage Data Model. Note: the umodel tho r@v to tables in seven
ori Data,
On the ribbon,thclick gm and Ris riz
hasg seven
ma Riste
ze a i te e i
sheets. d co l.com Cha d co l.com Cha
pie us pie us
sa he sa he
3. l l ow v. v.
llo been defined.
On the ribbon, click Diagram View. ed Note: the relationships between the models have already w ed
! !

Add a Calculated Column

1. On the ribbon, click Data View, and then click the factSalesTable tab.
Th Th
2. is click the column heading Add Column.
In the sheet, is
do do
cu cu
me me
3. Type = N n t
(equal),c thenbclick the column heading Order Quantity, type * nt then click the column heading
(asterisk),
ou au elon No ca belo
s gs Note: the formula appears in the formula bar u u
naandsthe ng of the calculation Order
List Price, nand
au press e Enter. uth evr@ result
st
tho vr@g to R o g
oR
Quantity, multiplied riz by List
m Price,
ail i s te appears in each row of the new column. Thisri is
ze an mexample
a ist of row context.
ed
co .co Ch dc i l.c e Ch
pie m a us o pie o m au
sa he sa sh
4. Double-click the column heading llo Calculated v. Column 1, type Revenue and press Enter. l ev.
we low
d! e d!
5. On the ribbon, in the Formatting section, click $ (dollar), and then click $ English (United States). Note: all
values in the Revenue column are now formatted to USD.

6. Click the column heading Add Column, insert the formula =[OrderQuantity]*[Product Cost], and press Enter.

7. Click the column heading Calculated Column 1, type Cost, and press Enter.
Th Th
is is
do do
cu cu
me me
nt nt
Use Calculated
No Columns
ca b in
elo a PivotTable No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
1. riz ma ist ze te
Navigate to the Excel ed workbooki eMod2_Demo2.xlsx. a
co l .c C ha d co il.com Cha
pie om us pie us
sa he sa he
2. Click New sheet. llo v. l l o v.
we we
d! d!
3. On the ribbon, click Insert, and then click PivotTable. Note: in the Create PivotTable, the radio button Use this
workbook’s Data Model is selected. Excel has recognized that there is already a data model.

4. In the Create PivotTable window, leave all the options at their default settings and click OK.

5. In the PivotTable Fields window, locate and expand factSalesTable. Scroll to Revenue and drag this field to
Th Th
the Valuesis pane. is
do do
cu cu
me me
6. In the PivotTable nFields
tb dimRegionTable. nt
No ca elo window, locate and expand No ca tobeCountry
Scroll
lon
and drag this field to
un us n g u n u s g
the Rows pane. au e
Note: the s PivotTable now shows revenue values for each au e
country. s
tho vr@g to R tho vr@g to R
riz i riz i
ed mail. ste C ed mail. ste C
7. In the PivotTable Fields co window,co h
locate
a and expand dimProductCategoryTable, c
scroll
o cto
o ha
pie m us pie m us
s he snow he
ProductCategoryName andalldrag ow this field
v. to the Columns pane. Note: the PivotTable a llo shows thev. product
ed we
categories in the columns, so that you ! have a revenue by country, by product category. d !

Add a Filter

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 13 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

1. In the PivotTable Fields window, locate and expand dimDateTable, right-click CalendarYear, and click Add
as Slicer.

2. In the CalendarYear slicer window, click 2007, and then click 2006. Note: the slicer is a filter that shows the
PivotTable results for the year that you select.

Work with Measures


Th Th
is is
do do
cu cu
1. In the Values pane,m en click Sum of Revenue. Note: this is an implicit measure. me The field dragged to the Values
tb nt
N e N b
pane was ca
o ufactSalesTable[Revenue].
lon o u cau thateldefaults
Excel automatically created a measure to the SUM function.
na u s e g s na se ongs
uth v r@ to uth v r@ to
o gm Ris ori gm Ris
2. In the drop-downrimenu, ze ail Value
d c click t Field Settings. ze
.co e Ch d c ail.c te Ch
op au op o au
ies m sh i s m sh
3. Scroll to show the other calculation all ev. that are available: Count, Average, Max,eMin,
functions a l StdDev, ev.
StdDevp,
ow l ow
Var, Varp, and Distinct Count. e d! e d!

4. In the Value Field Settings window, click Cancel.

5. In the PivotTable Fields window, locate factSalesTable and drag CustomerKey to the Values pane. Note: the
PivotTable now shows the Sum of CustomerKey, which is meaningless.

6. Th of CustomerKey and click Value Field Settings.


Click Sum Th
is is
do do
cu cu
me me
7. In the Value FieldntSettings window, scroll down, then click Distinct Count, nt then click OK. Note: the
and
No c b elo No ca belo
un aof
Distinct Count us CustomerKey
e n gs column now shows the number of u
customers
na u s who nghave generated orders for
au
tho vr@g to R uth evr@ s to
each product in each riz country. i o riz g Ri
ed mail. ste C ed mail. ste C
co co ha co c ha
pie m us pie om us
sa he sa he
llo v. l low v.
we e
Create Explicit Measures d ! d !

1. Navigate to the Power Pivot for Excel - Mod2_Demo2.xlsx window.

2. Click anywhere in the Values section of the screen.

Note: the Values section is the empty area underneath the data.
Th Th
is is
do do
3. c um
Type TotalRevenue:=sum(rev, then double-click [Revenue] in the drop-down cu
en me list, then type ) and press Enter.
tb nt
No ca elo No ca belo
4. u
On the ribbon, u
na in sFormatting,n g click $ (dollar) and click $ English (United u u s
naStates). ng
uth evr@ s to uth evr@ s to
ori gm R ori gm Ris
5.
ze
d cbelowail iste C ze
d ail te
Ch
In the Values section, .cthe
o TotalRevenue:
ha measure, type TotalCost:=sum(cos, co then .c double-click
op
ies m us pie om au
sh
factSalesTable[Cost] in theadrop-down h s
llo v. then type ) and press Enter.
elist, all
o
ev.
we we
d! d!
6. On the ribbon, in Formatting, click $ (dollar) and click $ English (United States).

7. In the Values section, below the TotalCost: measure, type Margin%:=(, then click the TotalRevenue: measure,
then type - (minus), then click the TotalCost: measure, type )/, and then click the TotalCost: measure and
press Enter.

8. On theThribbon,
is in Formatting, click %. Note: this measure refers toThother
is measures, not just columns in the
do do
table. cu
me
cu
me
nt nt
No ca b elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
Work with Explicit Measures ed mail. ste C ze a te
co c ha d co il.com Cha
pie om us pie us
sa he sa he
llo v. l l o v.
1. Navigate to the Mod2_Demo2.xlsx we -Excel window. we
d! d!
2. Drag Sum of Revenue and Distinct Count of CustomerKey out of the Values pane to the sheet to remove
them.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 14 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

3. In the PivotTable Fields table list, locate and expand FactInternetSales, then scroll to the bottom of the list.

4. Drag the measures TotalRevenue, TotalCost, and Margin% into the Values pane. Note: these are examples of
filter context.

5. Close Excel without saving changes.

Lab: Explore
Th
is
d
an Excel Data Model Th
do
is
oc cu
um me
en nt
tb b
No e N o u cau elon
Scenario un cause long na se g
au v s uth v r@ s to
tho r@g to R o g R
You have an Excel DatarizModel ist riz Themmodel ail isis
ed mafor Internet
e sales for your company, Adventure Works. ed t in a very basic
.co e Ch
co il.com Cha c o m au analyze the
state—you must create and format
pie calculated us columns and measures to develop a PivotTablep ies so you can sh
sa he all ev.
llo
data and produce business information. v. ow
we e
d! d!

Objectives
At the end of this lab, you will be able to:

Create and use calculated columns.


Th Th
is is
d do
• Format data inocthe
um Excel Data Model. cu
en me
tb nt
No c e No c be
• Create and use a us long
un measures. un ause longs
au e s au
tho vr@g to R tho vr@g to R
riz m i riz i
• Analyze data from a data a
ed model instea PivotTable. ed mail. ste C
co il.com Cha co co
m ha
pie us pie us
sa he sa he
llo v. llo v.
we we
d! d!
Lab setup

Estimated Time: 45 minutes

Virtual machine: 20779B-MIA-CLI

User name: TStudent


his Th
is
do do
cu cu
me me
nt nt
Password: Pa55w.rd
No ca belo No ca belo
un us ng un us ng
au e s au e s
tho vr@g to R tho vr@g to R
riz m ist riz m i st
Exercise 1: Create Calculateded a e Columns ed a e
co il.com Cha co il.com Cha
pie us pie us
sa he sa he
llo v. llo v.
we we
d! d!
Scenario

In this exercise, you will create calculated columns for several of the tables in the data model. You will then create a
PivotTable and add these and other fields to it.

The main tasks for this exercise are as follows:


Th Th
is is
1. do
Open the Workbook do
cu cu
me me
nt nt
be ca belo
2. ExploreNthe
ou c
Data au Modell No
na se o n g s un
au
us
e ng
s
uth vr@ to tho vr@g to R
o g Ri i st
3. Create CalculatedrizColumns
ed mail. ste C
riz
ed m a e
co c ha co il.com Cha
pie om u pie us
4. Create a PivotTable and Add s a Columns shev sa he
v.
llo . llo
we we
d! d!

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 15 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Detailed Steps ▼

Detailed Steps ▼

Detailed Steps ▼

T Th
DetailedhSteps
is
d

do
is
oc cu
um me
en nt
tb b
No ca e N o u cau elon
lon with calculated fields visualized in a PivotTable.
Result: An Excel
un Dataus Model g na se g
ev s
au
tho r@g to R uth v r@ s to
riz i o riz g Ri
ed mail. ste C ed mail. ste C
co co h au c op c o ha
p m ies m us
Exercise 2: Format DataiesModel all Datash
e v. all he
v.
ow ow
ed ed
! !

Scenario

In this exercise, you will format the calculated columns that you added to the Excel Data Model.

The main tasks for this exercise are as follows:


Th Th
is is
do do
1. Format Data in c cu
umthe Excel Data Model As Date and Review How This Changes
en me the Appearance of Your
t nt
PivotTable.
No c b e No c be
u n a u se l o n g s un ause longs
au v a uth vr@
t o r@g to R to
2. Format Data in hthe rizDatamModel As Currency ori gm Ris
ed ail iste C ze
dc a i l.
te
Ch
.c
co
pie om ha
us op com au
sa he i e s sh
llo v. all ev.
we ow
d! e d!
Detailed Steps ▼

Detailed Steps ▼

Result: A PivotTable with currency values formatted as US dollars.


Th Th
is is
do do
cu cu
me me
nt nt
Exercise 3: NoCreate b
ca Measures
elo No ca belo
un us n gs u na u s ng
au e uth evr@ s to
tho vr@g to R ori gm Ris
riz i
ed mail. ste C ze a te
co c ha d co il.com Cha
Scenario pie om us pie us
sa he sa he
llo v. l l o v.
we we
In this exercise, you will create explicit measures d! in your Excel Data Model, format these, and then add d! them to your
PivotTable.

The main tasks for this exercise are as follows:

1. Create Explicit Measures


Th Th
2. is
Use Measures is
do in Your PivotTable do
cu cu
me me
nt nt
No ca belo No ca belo
un us ng un us ng
au e s au e s
tho vr@g to R tho vr@g to R
Detailed Steps ▼ized ail. iste C
r m riz
ed m a i st
e
co c ha co il.com Cha
pie om us pie us
sa he sa he
llo v. llo v.
w e we
Detailed Steps ▼ d! d!

Result: A completed PivotTable that is ready to be used to analyze the Internet Sales data for AdventureWorks.

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 16 of 17
Module 2: The Excel Data Model 18.10.21, 17:23

Exercise 4: Analyze the Data

Scenario

The PivotTable is now populated with the fields, calculated columns, and explicit measures that you need to perform
useful business analysis. In this exercise, you will use filters and slicers to help you visualize useful information from
your Excel Data Model.
Th Th
i is
The main taskss for
do this exercise are as follows:
cu
do
cu
me me
nt nt
No c be No c be
1. u n a u se l o n g s
Add a Filter un ause longs
au v au v
tho r@g to R tho r@g to R
riz i riz i
2. Add a Slicer ed mail. ste C ed mail. ste C
co c ha co c ha
pie om us pie om us
sa he sa he
llo v. llo v.
we we
d! d!

Detailed Steps ▼

Detailed Steps ▼

Th
Result: Business Th group.
information that you have filtered by period and product
is is
do do
cu cu
me me
nt nt
No ca b elo No ca belo
Review Question(s)
u na u s n g u na u s ng
uth evr@ s to uth evr@ s to
ori gm Ris ori gm Ris
ze ze
d c ail.c te Ch d c ail.c te Ch
op o au op o au
Check Your Knowledge ies m sh ies m sh
all ev. a l ev.
ow low
ed ed
! !
Discovery
When you added FactInternetSales[Order Revenue] to the Values pane of the PivotTable, what was automatically
created?

Show solution Reset


Th Th
is is
do do
cu cu
me me
nt nt
No b elo No ca belo
Check Your Knowledge
un
ca
us
e n gs u na u s ng
au
tho vr@g to R uth evr@ s to
riz i ori gm Ris
ed mail. ste C ze a te
co c ha d co il.com Cha
Discovery pie om us pie us
sa he sa he
llo v. l l o v.
Explicit measures require a name. What we symbol is used to denote the end of the name and the start weof the measure
d! d!
formula?

Show solution Reset

Module review and takeaways


Th Th
is is
do do
cu cu
me learned how to create an Excel Data Model from raw Excel
In this module, you have me worksheet data, by creating
nt nt
No b elo
caand reformatting NoYou have ca seen be
tables and including
un us n them in the workbook’s data model. u u lon how to relate tables with a
a e g s n a s e gs
data model, and then u v
thoextend r t
@ the odata u
and its functionality by creating calculatedthcolumns v r and to measures by using the
riz gm Ris ori @gm Ris
DAX formula language. You e a te z e a te to visualize it
d chaveil.also seen
Ch how you can include your data model datadin a PivotTable
co il.com Cha
o p co m au p us
as business information. i es sh i es he
all ev. all v.
ow ow
ed ed
! !

https://www.skillpipe.com/api/2.1/content/urn:uuid:1f944ea8-5b0…-8da5-4f38c75c4c53@2020-12-11T16:42:28Z/OPS/html/20779B02.html Page 17 of 17

You might also like