Forum Discussion
JuanSombrero
4 years agoFrequent Visitor
DATEADD issue using variables
Hi everybody, I am running into the following issue. I am conviced it is related to me not propberly understanding (yet) how variables are being calculated, so any explenation would be greatly ap...
- Anonymous4 years ago
Hi JuanSombrero ,
Variables can be used anywhere but are evaluated in the context in which they are written.
You can refer the below blog for more understanding
https://radacad.com/caution-when-using-variables-in-dax-and-power-bi
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
rbriga
4 years agoImpactful Individual
The variable is calculated once per context.
For example:
Distance from Average=
VAR _Avg = AVERAGE(Sales[Sales])
RETURN
AVERAGEX(
VALUES(Users[Id]),
SUM(Sales[Sales])-_Avg
)Would return the average difference from the average of ALL selected users (rather than each individual user's average), unless the row context is the specific user.