Forum Discussion
DateAdd function in column not working
- 8 years ago
Hi anandav,
This is a question of context, if you remove the previous month from your table view it will give you the calculation you need.
Be aware that the measure are very sensitive in terms of context and if you don't place a certain column in your measure, when you add that measure with that column the value will be off.
Regards,
MFelix
Hi anandav,
Why are you trying to create a calculated column with previous month to calculate the total sales of previous month?
The best way is to have a calculated measure using the DATEADD or similar.
Your measure should look something like this:
Prev Month Sale = CALCULATE(SUM(Sales[Amount]); DATEADD(Sales[Date]; -1; MONTH))
Beware that using the DAX formula on columns is different from measures, since the context is given in different way, that's why the Prev. Month sales 1 is working and the second one is not since you are taking context from your DAX formula and the calculation is incorrect.
Regards,
MFelix