Forum Discussion
Measure vs Variable in Calculate / Filter
I have the follwing measure that works. However if I remove the variable __T and make that a standalone measure and put that mesure in its place the results are incorrect. Why? I wold rather use a stand alone mesure instead of a variable. Any thoughts?
DAX for correct vs incorrect results below
thanks
Alan
** CORRECT RESULT **
** INCORRECT RESULT **
2 Replies
- Ritaf1983Super User
Hi asjones
Variables are stored in memory like "constants", so there are some cases where they aren't needed.
Here's a link to the video and article for more info:
https://radacad.com/caution-when-using-variables-in-dax-and-power-bihttps://www.youtube.com/watch?v=NbbE39gwVVo
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- asjonesHelper V
thanks for the response, but this is kinda the opposite situation. The variables work and if I put the code inline it works. This does not work when i use it as a standaline measure that is referenced. I would prefer a standlone measure so I can reuse that part in more than one report.
Any other thoughts from anyone?