Forum Discussion
Previous month calculation
Anonymous
Try Like
last Month =
var _maxP = maxx('Period','Period'[snapshot Period])
var _max1 = maxx(filter('Period','Period'[snapshot Period]=_maxP),'Period'[Date])
var _max = date(year(_max1),month(_max1)-1,10)
var _min = date(year(_max),month(_max)-1,1)
return
CALCULATE(SUM('Sales'[Sales]), FILTER(all('Date'), 'Date'[Date]<=_max && 'Date'[Date]>=_min))
Can you share sample data and sample output.
- v-xuding-msft6 years agoCommunity Support
Hi Anonymous ,
You could upload your dummy pbix file into OneDrive for Business and post the link here. Please do mask sensitive data before uploading.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- v-xuding-msft6 years agoCommunity Support
Hi Anonymous ,
Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from the thread.
If you still have questions, please share a sample to us. Then we will understand clearly.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.