Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have been trying to learn more about Optimising Dax using a data sample from sqlbi (DAX Optimizations Examples with Alberto Ferrari) Orders Table has 1.6 million rows of data. I have two identical measures except one does not use variables. The measure with variables takes 14 seconds to execute and the other 0.5 seconds. I am unsure why variables are having an impact on performance.
Measure 1
To be able to answer the question one has to see the execution plans for both queries. There is no other way.
However, some things to observe:
1. The two measures (they are not queries!) are not logically equivalent.
2. The second one removes all filters from 'Date' BEFORE calculating the number of rows, so the logical expressions in filter can be totally ignored (in the presence of the assumed relationship). This is not the case in the first query when you first calculate the bounds and then use the bounds in the expression. These bounds stay put despite the ALL directive.
did really these querys return the same result?
Yes identical results just different execution times
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
11 | |
9 | |
8 | |
8 |