Forum Discussion
DATEADD issue using variables
- 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)
Hi JuanSombrero ,
Create this as a separate measure.
Sales Measure = SUM('Invoice detail'[Total excl. VAT])
and then try
VAR Sales_LM = CALCULATE([Sales Measure], DATEADD('Calendar'[Date],-1,MONTH))
Regards,
Harsh Nathani
Hi Harsh,
that would indeed solve the issue. But could you explain me as well why my solution is not working? I have a feeling that the 'why' is very important here for me not to run into comparable issues in the future.
Thx
Jan
- Anonymous4 years agoNot applicable
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)