Forum Discussion
beepboop
2 years agoFrequent Visitor
Using PREVIOUSMONTH function to calculate previous month sales, able to filter the dates column
So looking through the syntax of PREVIOUSMONTH(dates) function, you would need to specify a dates column and it would return the previous month based on the first value of the dates column. Problem i...
- Anonymous2 years ago
Hi beepboop
Please try this:
First of all, I create a set of sample data:
Then create a measure:
Measure = IF( MONTH(TODAY()) - 1 = 0, CALCULATE( SUM('Table'[value]), FILTER( ALLSELECTED('Table'), MONTH('Table'[date]) = 12 && YEAR('Table'[date]) = YEAR(TODAY() - 1) ) ), CALCULATE( SUM('Table'[value]), FILTER( ALLSELECTED('Table'), MONTH('Table'[date]) = MONTH(TODAY()) - 1 && YEAR('Table'[date]) = YEAR(TODAY()) ) ) )The result is as follow:
Best Regards,
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Daniel29195
Community Champion
2 years agoSorry, i didnt quite understand what is the requirement,
if you are in feb 2023, what do you want your measure to return ?