1. CPBIG Local Meet – February 2019 Chennai Power BI – February 2019
PASS
Understanding the Power BI Data Model
Hariharan Rajendran
Microsoft Certified Trainer
2. Chennai Power BI
About me
Microsoft Certified Trainer.
8+ years experience.
Experience in Business Intelligence
• Microsoft BI
• SAP Business Objects
Expertise in Microsoft Technologies. http://dataap.org/author/hariharanr/
@imhariharanr
hariharan-r-12635640
3. Chennai Power BI
Power BI Model
Introduced in 2010 – Power Pivot for Excel
OLAP Experience
In-Memory column store database (Vertipaq)
Powerful Analytical formula language (DAX)
Power Query – 2013
Power BI, Excel & Analysis Service (Azure)
4. Chennai Power BI
Why Power BI Model?
Interactive analytics at the speed of thought
• Slice and dice without writing queries
• Perform business calculations
• Support for high concurrency to support enterprise reporting
• Easy and expressive KPIs, Hierarchies, drill through, naming & translations
• Security to the data
6. Chennai Power BI
Power Query
Connectivity to a wide range of data sources
Highly interactive and intuitive experience for rapid and
interactive construction for queries over any data source
and any size.
Joins across different data sources
Easy and Interactive UI
Rich Language
7. Chennai Power BI
M Language
Evaluation flows from one step to next step
Results of previous step used in the next step
Each step is stored as variable and reused later steps
M has Lazy Evaluations.
let
Source = Sql.Databases("."),
AdventureWorksDW2014 = Source{[Name="AdventureWorksDW2014"]}[Data],
dbo_DimProduct = AdventureWorksDW2014{[Schema="dbo",Item="DimProduct"]}[Data],
#"Filtered Rows" = Table.SelectRows(dbo_DimProduct, each ([Color] <> "NA")),
#"Capitalized Each Word" = Table.TransformColumns(#"Filtered Rows",{{"Color", Text.Proper, type text}})
in
#"Capitalized Each Word”
8. Chennai Power BI
Query Folding
Power Query pushes work back to the source system
whenever it can.
select [_].[ProductSubcategoryKey],
[_].[ProductSubcategoryAlternateKey],
[_].[EnglishProductSubcategoryName],
[_].[ProductCategoryKey]
from
(
select [ProductSubcategoryKey],
[ProductSubcategoryAlternateKey],
[EnglishProductSubcategoryName],
[ProductCategoryKey]
from [dbo].[DimProductSubcategory] as [$Table]
) as [_]
where ([_].[EnglishProductSubcategoryName] = 'Mountain Bikes' or [_].[EnglishProductSubcategoryName] = 'Road Bikes’)
or [_].[EnglishProductSubcategoryName] = 'Touring Bikes'
9. Chennai Power BI
Data Storage
Data is either stored in memory (Vertipaq) or stored at the
data source level (DirectQuery).
In memory is fast and interactive build for analytics
Column based compression.
Direct Query is always up to date, it relies on data source
performance
Vertipaq – Performance
• Query Performance > Processing performance
10. Chennai Power BI
How does data get loaded?
Table 1
Table data stored in segments & dictionaries per columns
Calculated columns are stored like regular columns
Hierarchies
Relationship structures
Table 2
12. Chennai Power BI
Relationships
Data is always filtered from 1 to M side.
This works great in star schema
What if we don’t have a star schema? Or want to count
values in dimension?
In each country, how many customers bought bikes?
Bi-directional relationship
14. Chennai Power BI
DAX
Introduced as part of Power Pivot – add-in for excel
Formula for calculated columns, measures and tables
Navigate relationships
Dynamic calculation of measures
Table valued functions
Time Intelligence
Variables
15. Chennai Power BI
Purpose of DAX
Calculated Columns
• Value is computed for each row
• Materialized in tables as a static column – It consumes memory
• It can be used for slicers and filters
• All rows contain same formula.
Calculated Measures
• Numeric calculation
• Not Materialized
• Dynamic – Does not consume memory
• Evaluated for each row based on the given context.
16. Chennai Power BI
Navigation Functions
RELATED
• Follows the relationships and returns the
value of a column
• Single value as a result
RELATEDTABLE
• Follows relationships and returns all the rows
in relationship with the current row value.
19. Chennai Power BI
Direct Query
Don’t want to wait for data to load. Need real-time data
Performance - Query patterns
Concurrency
Security
20. Chennai Power BI
Direct Query
Use an optimized data source if possible
Optimize for analytics
• Systems should handle querying of dimensions and facts
• Analytical ready data source helps
• SQL Server in Memory
• SAP HANA
Use Bi-directional cross filtering
Understand security requirements
RLS is very expensive
23. Chennai Power BI
Resources
CPBIG Webinar Recordings -
http://dataap.org/cpbig/webinar-recordings/
SQL Server, Power BI & AI - http://dataap.org/blog/
Power BI User Group - Chennai
1. Sales Amount
-- computed for row by row
-- Memory
-- Product[Price]
The value of the price column
from the product table
for the current row
Different for each row
2. Profit Margin
-- Calculated column
-- Calculated measure