This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi all,
I am trying to optimize a measure for excess stock. The old way of doing it was a lot of different measures being used in other measures, that were used in other measures etc. This was very slow, and I am using VAR to do it in one measure. The last part of the measure is a Hasonefilter / SUMX in order to sum the measure per row and get the "correct" total.
ISSUE:
When I do this in one measure using VAR, it does not sum in the totals, but when I do it in two different measure, where I put the Hasone / SUMX part in a seperate measure, it does it correctly. QUESTION: Can I fix this so I can keep only one measure?
MEASURES:
Measure that does not sum:
Solved! Go to Solution.
Hi, @Anonymous
Variables can be used anywhere, however, their result might not be always the same. Because they are evaluated in the context in which they are written.
Caution When Using Variables in DAX and Power BI
You can also refer to this similar thread.
Different results depending on dax in measure vs. same dax in variable
@mahoneypat wrote:
When calculated as a variable first it is in the evaluation context of the visual. Putting the variable inside the CALCULATE(variable, FILTER(... does not recalculate the expression in the desired new evaluation context.
Best Regards,
Community Support Team _ Eason
Hi, @Anonymous
Variables can be used anywhere, however, their result might not be always the same. Because they are evaluated in the context in which they are written.
Caution When Using Variables in DAX and Power BI
You can also refer to this similar thread.
Different results depending on dax in measure vs. same dax in variable
@mahoneypat wrote:
When calculated as a variable first it is in the evaluation context of the visual. Putting the variable inside the CALCULATE(variable, FILTER(... does not recalculate the expression in the desired new evaluation context.
Best Regards,
Community Support Team _ Eason
Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |