- Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time...

23
www.sqlbi.com

Transcript of - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time...

Page 1: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

www.sqlbi.com

Page 2: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

DAX Optimization Examples

Alberto Ferrari - SQLBI

Page 3: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Expo Sponsors Event Sponsors

Expo Light Sponsors

Page 4: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

We write

BooksWe teach

CoursesWe provide

ConsultingWe are recognized

BI Experts

Remote

Consulting

Power BI/SSAS

Optimization

BI Architectural

Review

On-Site

Consulting

Custom Training

& Mentoring www.sqlbi .com

Page 5: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

It all starts this way…

“Would you mind taking a look at

my report? It is slow and I am sure

it will take you no more than a

couple of minutes to fix it”

Page 6: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Agenda

o Optimize a report step-by-step

o in the meantime find some time to:

• Learn the basics of useful tools to measure performance• Understand the way DAX solves your queries• Learn about Formula Engine and Storage Engine• Measure performance and detect bottlenecks• Reproduce the issue and measure it again to obtain better

findings• Solve the problems, one at a time

• No “wow effects” here… we want to simulate a real-world example

Page 7: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

First look

Let us open the report for the first time…

Page 8: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

1 2 3

45

Page 9: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Where is my problem?

o A simple report like this, is already too complex

o Three measures:

• Amount USD, Amount EUR, Open Orders

o Different ways of slicing and combining values

o Trial and error is not the way to go

o Do you really want to google “what’s wrong with my

report”?

Page 10: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

DAX Studio

o The ultimate tool for working with DAX queries

o Completely free

o Works with Power BI, Power Pivot, SSAS Tabular, Azure

Analysis Services

o It provides tons of information, but you need to be able

to read it

o Download and install from www.daxstudio.org

Page 11: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Fighting with the cache

o There are multiple cache levels

• they are your enemies as of now

o Power BI cache

• Useful when authoring reports

• Avoids executing the query at all if not needed

o DAX cache

• Caches results of internal VertiPaq queries (more on this later)

• Can be cleared from withing DAX Studio

o Avoid the cache to measure performance

Page 12: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Create an empty page in Power BI

o An empty page lets you start Power BI Desktop without

computing any report

o Open Power BI on the empty page

o Open DAX Studio and connect to Power BI

o Start tracing all queries

o Collect the results

o Stop the tracing

Page 13: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

1

2 34

5

Page 14: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Currency Conversion

Focus on DAX to search for a better way to write currency conversion

Page 15: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Following best practices

o Best practices are always helpful

• there are not so many in DAX

• it is easier to follow them

o Use variables as much as you can to fix values

o Avoid computing the same value multiple times

o Make it simpler, then simpler, then… simpler

Page 16: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

The two engines in DAX

Page 17: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

The two engines in DAX

Page 18: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Differences between the engines

Formula Engine

• Computes any DAX function

• Very rich in terms of expressivity

• Single threaded

• Slow side of DAX

Storage Engine

• Computes simple expressions

• Uses model relationships

• Multi threaded

• Fast side of DAX

Performance

Page 19: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Open Orders

Next step is optimizing the open orders measure

Page 20: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

October, 2017

Open Orders

Order 1

Order 2

Order 3

Order 4Order 5

Open Orders = 3

Page 21: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

October, 2017

Changing the data model

Order 1

Order 2

Order 3

Order 4Order 5

Page 22: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Conclusionso Download and install DAX Studio

• get ready to spend time learning

o Measure, test, change, loop

o DAX Studio is your best friend here

o Optimizing is a complex process

• It requires a deep understanding of the internals

• Formula engine, storage engine, data caches, columnar

databases

o At www.sqlbi.com you will find plenty of resources on DAX

Page 23: - Intelligent Cloud Conference...o Download and install DAX Studio •get ready to spend time learning o Measure, test, change, loop o DAX Studio is your best friend here o Optimizing

Thank you!

Check our articles, whitepapers and courses on

www.sqlbi.com