Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone,
I want to know that does the variables are already calculated before RETURN statement?
For example:
Measure =
VAR A = SUM(Table[ColumnA])
VAR B = SUM(Table[ColumnB])
RETURN
IF(TODAY()=DATE(2020,07,11),A,B)
So, in the measure above,
will both the variables A & B be calculated and then the RETURN statement is executed?
OR
It would first check the condition and then calculate A or B according to the condition?
I have checked out multiple videos & blogs, but it doesn't answer my question.
Any help is appreciated.
Thanks.
Solved! Go to Solution.
Hi @rajulshah
Yes, VARiables are calculated before the RETURN
So, if you do want to reduce amount of calculation you can calculate it inside RETURN statement
Also, I highly recommend you to try both options and compare its in the built-in Performance Analyzer https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
Hi @rajulshah
Yes, VARiables are calculated before the RETURN
So, if you do want to reduce amount of calculation you can calculate it inside RETURN statement
Also, I highly recommend you to try both options and compare its in the built-in Performance Analyzer https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
Hello @az38,
Thanks for the answer. I actually tried to investigate using Performance Analyzer, but wasn't able to conclude properly.
Thanks again!
@rajulshah , to calculate it beforehand you might use sumx or calculate.
refer if these can help
https://powerbi.tips/2017/05/using-variables-within-dax/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |