Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Uhrond
Frequent Visitor

DAX Optimisation

Hi,

 

I have multiple measure that start with the same variable :

VAR TO_CALCULATE = IF(AND(COUNTROWS(INDIC) = 1, MAX(INDIC[TYPE_LIGNE]) = "INDIC") , TRUE() , FALSE())

 Is it faster to create one separate measure "TO_CALCULATE" with this formula and use this new measure in my multiple other measure ?

 

Thank you

1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

In terms of performance, using a variable is generally faster because it’s calculated once within the context of the measure where it’s used.

 

If the logic is complex and used in many different measures, defining it once as a variable and then using that variable within the same measure can be more efficient than referencing a separate measure multiple times.

 

Hence, Variables are better in performance. 

 

DAX Variables: Better Readability, Consistency, and Performance in Power BI Calculations - RADACAD




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
Kaviraj11
Super User
Super User

In terms of performance, using a variable is generally faster because it’s calculated once within the context of the measure where it’s used.

 

If the logic is complex and used in many different measures, defining it once as a variable and then using that variable within the same measure can be more efficient than referencing a separate measure multiple times.

 

Hence, Variables are better in performance. 

 

DAX Variables: Better Readability, Consistency, and Performance in Power BI Calculations - RADACAD




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.