Understanding the optimization of SWITCH

  Рет қаралды 12,556

SQLBI

SQLBI

Күн бұрын

Пікірлер: 19
@stevecoleman9522
@stevecoleman9522 2 жыл бұрын
This video and associated article are very enlightening Marco. Thank you. The Formula Engine behavior can be a mystery, but videos like this shed light on how the FE works.
@azajoey1
@azajoey1 2 жыл бұрын
I actually used index / id based switch in my recent project. as the model grew, one visual started to run for 30 seconds. I thought integer based switch will be a good solution. then i tried using the same descriptive column which is present in the slicer and become 3 seconds, and ever since then with further logic and complexity added, remained with same performance. obviously my choice was simply a brute force try-catch, but still! amazing! thanks for the deep-dive
@craniumnr
@craniumnr Жыл бұрын
Nice video, but I have some questions in my mind: 1- What if we are using live connection? 2- What if we have filters on the visual we have the measure and not on the slicer? 3- What if we have more than 1 slicer? 4- What if we have filters within the measures?
@Bharath_PBI
@Bharath_PBI 2 жыл бұрын
Thank you master, feel like watching your video after a long time.
@johansantacruz6464
@johansantacruz6464 2 жыл бұрын
Thanks for this video! It's clear and useful for DAX devs.
@michaelmuell
@michaelmuell Жыл бұрын
Thanks so much for this! ❤ A dashboard suddenly had incredibly long (>30 sec) load times after I made the pages dynamic using SWITCH. I couldn't figure out why. In the end, removing a page filter solved the problem and decreased the load time to 2 sec.
@louism.4980
@louism.4980 8 ай бұрын
Very technical, thank you for sharing your knowledge! :)
@MuscleMUSEums
@MuscleMUSEums 6 ай бұрын
thank you very much, amazingly explained!
@fly2sky99
@fly2sky99 2 жыл бұрын
Thanks for great video. Interesting to know what's happending inside the engine.
@omarbn92
@omarbn92 Жыл бұрын
Thank you for the video, will row level security on measure option slicer impact performace of switch ?
@SQLBI
@SQLBI Жыл бұрын
It shouldn't.
@Guiburgueir4
@Guiburgueir4 2 жыл бұрын
Hi Marco, What is your opinion on the new "Field Parameters" slicers compared to this? I not too knowledgeable about the query plan but as far I checked it looks simpler.
@SQLBI
@SQLBI 2 жыл бұрын
For this specific use case Field Parameters are a better and faster solution. However, the article is about SWITCH optimization, and this is a very simple use case. Moreover, Field Parameters works only for Power BI, not in other client (not supported for Analyze in Excel, for example).
@th3n0rthsid3
@th3n0rthsid3 2 ай бұрын
Thanks for asking the question, it was one of the first questions to come to my mind as well :)
@tejasbrahmbatt5344
@tejasbrahmbatt5344 2 жыл бұрын
Would be interesting to see if the fields parameter generates more optimal query plan than switch
@SQLBI
@SQLBI 2 жыл бұрын
Yes, fields parameter are usually better because they change the query generated by Power BI, making the entire process more efficient. More details here: www.sqlbi.com/articles/fields-parameters-in-power-bi/
@noahhadro8213
@noahhadro8213 Жыл бұрын
I have a measure that looks like this..... var _Selected = Selectedvalue(DynamicMetric[Metric],"Sales") RETURN Switch(_Selected, "Sales", Sum(FactSales[Sales]), "Cost", Sum(FactSales[Cost]), "Profit", Sum(FactSales[Profit])). When I run this against my relatively large model with Dimensions Product, Seller, and Customer it takes 7 seconds. when "Cost" is selected. But when I swap out this measure for just the "Cost" measure... Sum(FactSales[Cost]) it takes 3 seconds. The only difference in dax studio that I can see if the A Callbackid is generated when using the "switch Measure". Note that the switch selected value is directly what I am filtering on per your videos. Can Switch really kill performance this bad?
@GaryMillerUK
@GaryMillerUK 2 жыл бұрын
Third of the way through and he's barely mentioned SWITCH yet. I don't have the time for this when I'm working. Does the average person need to see all this under the hood stuff? Don't they just want to speed up their queries? I'm sure this is fascinating if you have the time to study it deeply. Maybe I'm not in the intended audience.
@SQLBI
@SQLBI 2 жыл бұрын
This is an advanced article+video that explains how the optimization works. You could quickly scan the related article to see the differences in code in a few seconds. You can find the link in the video description.
Solving errors in CALCULATE filter arguments
30:55
SQLBI
Рет қаралды 31 М.
Optimizing nested iterators in DAX
17:31
SQLBI
Рет қаралды 22 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
When are variables evaluated in DAX
26:36
SQLBI
Рет қаралды 13 М.
Why We Love Dataflows In Power BI And Why You Should To
11:48
Enterprise DNA
Рет қаралды 16 М.
Propagating filters using TREATAS in DAX
19:18
SQLBI
Рет қаралды 47 М.
DAX for Power BI Part 2.3 - The Switch Function
20:51
WiseOwlTutorials
Рет қаралды 12 М.
The Most Important DAX Functions You Must Know in Power BI
20:23
[DAX] Best Practices 101 for Optimization & Performance (with Alberto Ferrari)
1:26:41
Row Context in DAX
20:42
SQLBI
Рет қаралды 106 М.
Variables in DAX
16:46
SQLBI
Рет қаралды 37 М.
Understanding context transition
18:25
SQLBI
Рет қаралды 73 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН