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

Advanced Data Modeling in Power BI

Uploaded by

Rahul Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Advanced Data Modeling in Power BI

Uploaded by

Rahul Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Advanced Data

Modeling with
Power BI

Insert coins to start


Set the stage

Gather Clean Model Visualize


Your basic understanding

Star Schema Relationship types Role Playing Dimensions


Learning objectives

Explain data modeling Leverage one and bi- Successfully implement Work with real live
best practices in directional relationships aggregations scenarios containing
general multiple fact tables
Today’s agenda
Relationships revisited
Relationship direction
Working with multiple fact
tables
Implementing Aggregations
Wrap-up
Relationships revisited
Relationship types

1 to 1 1 to many Many to many


Relationship direction

Singular Bi-directional
Relationship direction
Bi-directional relationships can result in surprising results, especially when working with multiple
fact tables
It can have performance impacts and ‘overfilter’
Can lead to ambiguity

Try to avoid bi-directional relationships


You can influence the direction of a relationship for the context of a calculation by CROSSFILTER in
DAX:
CROSSFILTER( column1, column2, direction )
Relationships direction
Ambiguous data models
Two filter paths to the same table
Leads to unexpected results

Can happen with bi-directional relationships


Avoid bi-directional relationships
as much as possible
Ambiguous data models
Can lead to unpredictable results
Each of these measures calculates
the same, but removes one of the
relationships
By using CROSSFILTER you can
change relationships in a measure
context
Ambiguous data models
Unexpected filter behavior
Result will be filtered by a subset of
products as part of the Internet Sales
(dark blue filter path)
Sub-set
Result will be filtered by a subset products
Sub-set
of dates (orange filter path) products

Dates
Dates
Demo – relationships direction

Demo
time!
Relationships &
Row level security
Does not filter dimensional tables
Except over 1:1 bi-directional
relationships
Possible when adding a RLS filter
to each table individually
Requires a specific setup regarding
relationships
Relationships &
Row level security
Uses single directional filters by
default
you can set ‘Apply the Filter Direction
when using Row Level security’ on a
bi-directional relationship to force
RLS to use bi-directional filtering
Useful for dynamic row level security
Demo – Row Level Security

Demo
time!
Handle multiple fact tables
Multiple fact tables
Multiple fact tables are common in real-life scenarios. Common scenarios:

Not sure what scenario you have? Use a mapping table.

Order Sales
Currency Customer Due date Employee Product Promotion Reseller Ship date
date territory

Internet sales X X X X X X X

Reseller sales X X X X X X X
Multiple fact tables

Order Sales
Currency Customer Due date Employee Product Promotion Reseller Ship date
date territory

Internet sales X X X X X X X

Reseller sales X X X X X X X

If you decide to append these, you will get (blanks) when you use
one of the unmatched columns
Demo – Multiple fact tables

Demo
time!
Implementing Aggregations
Aggregations
Benefits
Report visualizations are faster

Balanced architecture by combining Direct Query and Import storage modes

Store data at a higher level of granularity than the original table


The following aggregations are available:
count, groupby, max, min, sum, and count table rows

Aggregated data is stored in-memory (imported), details are accessed through DirectQuery

You can create the aggregated table in the


Data Transformations (Power Query) or in your source (preferred)
Aggregations
Aggregations & storage modes
Aggregation, that hit based on relationships, require regular relationships.

Regular relationships include the following storage mode combinations,


where both tables are from a single source group:

Table on the many side Table on the 1 side


Relationships & storage modes
A model relationship is limited when
there's no guaranteed "one" side. It
can be the case for three reasons:
The relationship uses a Many-to-
many cardinality type (even if one or
both columns contain unique values)
The storage mode combination is
Import and DirectQuery
The relationship is cross source group
Impact of limited relationships
Demo – Aggregations

Demo
time!
Automatic Aggregations – Preview!
Wrap up
Use a star schema or snowflake data model to get the best out of Power BI.

Be careful leveraging bi-directional relationships

Avoid ambiguous data models

Consider leveraging aggregations to help analysis of big data

Be prepared to deal with multiple fact tables


Resources
Learning path: Model data in Power BI:
https://aka.ms/DataModelingLearningPath

Learning path: Use DAX in Power BI Desktop:


https://aka.ms/DAXLearningPath

Aggregations in Power BI Desktop:


https://aka.ms/PowerBIDesktopAggregations

DAX function: CROSSFILTER:


https://aka.ms/DAXCrossfilter

Model relationships in Power BI Desktop:


https://aka.ms/ModelRelationships

Whitepaper: Bidirectional cross-filtering for Power BI Desktop:


https://aka.ms/BidirectionalCrossFilteringWhitepaper

AdventureWorks 2020 demo dataset:


https://aka.ms/AW2020Dataset

You might also like