Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi Guys!
I created the following Variable:
EUR =
var summa = SUM(Sheet1[amount])
return
CALCULATE(summa;Sheet1[currency]="EUR")
I want to return the sum of EUR from my list.
The Calculate function does not want to work, it does not want to filter for EUR at all. The result is the same every time (the "summa" what I defined as a variable), no matter what I am filtering for in Calculate.
If I am Calculating the sum of EUR separately with 2 measures, than it works.
No idea what is going wrong.
Do you have any advice?
THank you
S.
Solved! Go to Solution.
Hi Sturla!
Thank you for your answer.
I have 3 other measure combinations for such calculation. I just wanted to try another way + getting familiar with the concept of variables in dax. That is why I was surprised when I did not get the expected result in the return section of the code.
I still not get it why it is so. I believed that the return section was for combining, altering all the variables defined above.
Thank you
S
Yes, the variables are a bit confusing, they are kind of static once they are calculated, so the name variables is a bit counterintuitive
Hi, @Anonymous,
what you experience is by design. The variable is calculated before the context of the measure, Currency="Eur", is applied.
For such a simple measure, there is nothing to gain by using a variable, your measure should be:
EUR =
CALCULATE (
SUM ( Sheet1[amount] );
FILTER ( SHeet1; Sheet1[currency] = "EUR" )
)
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi Sturla!
Thank you for your answer.
I have 3 other measure combinations for such calculation. I just wanted to try another way + getting familiar with the concept of variables in dax. That is why I was surprised when I did not get the expected result in the return section of the code.
I still not get it why it is so. I believed that the return section was for combining, altering all the variables defined above.
Thank you
S
Yes, the variables are a bit confusing, they are kind of static once they are calculated, so the name variables is a bit counterintuitive
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 |
---|---|
11 | |
6 | |
3 | |
3 | |
3 |
User | Count |
---|---|
11 | |
10 | |
8 | |
8 | |
7 |