Forum Discussion
Last month data filter in DAX
- 9 years ago
I just posted this for another thread that was looking for something simular. Hope it helps! FOrrest
Prior_Month = CALCULATE(SUM(Table2[Price]), // Sum Price
DATESBETWEEN(Table2[Salesdate], // Based on Dates Between
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1), // Date having Year = Today -1 Month / Month = today -1 Month, and Day = 1
EOMONTH(today(),-1))) // End Of Month effective today() -1 month
I just posted this for another thread that was looking for something simular. Hope it helps! FOrrest
Prior_Month = CALCULATE(SUM(Table2[Price]), // Sum Price
DATESBETWEEN(Table2[Salesdate], // Based on Dates Between
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1), // Date having Year = Today -1 Month / Month = today -1 Month, and Day = 1
EOMONTH(today(),-1))) // End Of Month effective today() -1 month
- AndersMadsen8 years agoHelper I
What happens when it's January and you give it 0 as a month?
- Anonymous7 years agoNot applicable
Thank you! I tried to do this with a simple CALCULATE function filtering by previous month(tried it several different ways), and I couldn't get it to work. This worked though.