0% found this document useful (0 votes)
84 views18 pages

From SQL To Dax: @anniexu1990

This document summarizes the key points about moving from SQL to the DAX querying language for tabular models in Power BI and Power Pivot. It introduces DAX, explains why it is faster than SQL due to technologies like column storage and compression, and provides techniques for writing efficient DAX queries, including understanding the formula and storage engines and performing query plan and performance tuning. Demo code is included to illustrate translating SQL concepts like filtering and joins into DAX.

Uploaded by

Fer TWS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
84 views18 pages

From SQL To Dax: @anniexu1990

This document summarizes the key points about moving from SQL to the DAX querying language for tabular models in Power BI and Power Pivot. It introduces DAX, explains why it is faster than SQL due to technologies like column storage and compression, and provides techniques for writing efficient DAX queries, including understanding the formula and storage engines and performing query plan and performance tuning. Demo code is included to illustrate translating SQL concepts like filtering and joins into DAX.

Uploaded by

Fer TWS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 18

FROM SQL to DAX

@Anniexu1990
Who I am
• Dan (Annie) Xu
• Business Intelligence Consultant
• MCSA -> MCSE (BI)
• Blog: https://anniexu1990.com
• All social media accounts (including gmail): anniexu1990
BEFORE We BEGIN
Agenda
• Why use DAX
• SQL to DAX – As Querying Language
• Why faster and key techniques
• Query plan and performance tuning
Why use DAX
• The Modeling, and Querying language for SSAS Tabular Models
(PowerBI and Power Pivot - local instance of Analysis Service)
• Excel pivot table, SSMS or SSRS – MDX is the default language against
SSAS models
• More secure and one source of truth - client
• Faster in almost all analytic situations (column store and Vertipaq
compression)
• Another Option to extract and analyze data (replace ETL, customized
measures etc.)
SQL to DAX – As Querying Language
• Select
• Grouping
• Table Joins
• Aggregation
• Filter
• Customized measures

DEMO
Let’s compare the timing
Why faster - Column Store vs. Row Store

http://saphanatutorial.com/column-data-storage-and-row-data-storage-sap-hana/
Why faster - VertiPaq Compression (reduce
memory footprints)

https://www.microsoftpressstore.com/articles/article.aspx?p=2449192&seqNum=3
How to make DAX faster?
Formula Engine vs. Storage Engine

Category Formula Engine Storage Engine

Thread Single - Threaded Multi – Threaded

Cache No Yes
utilization
Performance Check physical plan Check xmSQL queries
Tuning (a textual
representation of SE
query)
Performance Tuning for DAX
“The most important factor of DAX formula speed is data distribution”
• Vertipaq Analyzer

Formula Engine Bottlenecks


• Redundant logic steps
• Long iterations over datacaches

Storage Engine Bottlenecks


• Long Scan time
• Large cardinality
• High frequency of CallbackdataID (a function in Storage Engine communicating back
to formula engine for complicated calculations which disable the cache)
• Large materialization
Appendix List
• Useful Links
• Key Concepts
• Useful Tools for DAX and Tabular Modeling
• My Demo Code
Useful Links
• https://www.sqlbi.com/
• https://powerpivotpro.com
• http://anniexu1990.com
• Book: The Definitive Guide to DAX
Key Concepts
• Column store vs. row store technology
• Vertipaq compression
• Row context vs. filter context
• Formula Engine vs. Storage Engine
Useful Tools for
DAX and Tabular Modeling
• DAXStudio
• Vertipaq Analyzer
• DAX Editor
My Codes used in the demo
• SQL to DAX: Select, Grouping and Table Joins
• SQL to DAX: Filter and Customized Measures

You might also like