Forum Discussion
Prior Month DAX with Measure
- 4 years ago
Here's one way to do it (with a similar approach to the measure you already have). I used an existing model to try the approach out. My Recent Month measure is the same but with 0 instead of -1 in the EOMONTH part.
Total Sales Previous Month =
VAR EOMmaxSalesDate =
EOMONTH ( MAXX ( Sales, Sales[SaleDate] ), -1 )
RETURN
CALCULATE (
[Total Sales],
FILTER ( ALL ( 'Date'[MonthEnding] ), 'Date'[MonthEnding] = EOMmaxSalesDate )
)Pat
Here's one way to do it (with a similar approach to the measure you already have). I used an existing model to try the approach out. My Recent Month measure is the same but with 0 instead of -1 in the EOMONTH part.
Total Sales Previous Month =
VAR EOMmaxSalesDate =
EOMONTH ( MAXX ( Sales, Sales[SaleDate] ), -1 )
RETURN
CALCULATE (
[Total Sales],
FILTER ( ALL ( 'Date'[MonthEnding] ), 'Date'[MonthEnding] = EOMmaxSalesDate )
)
Pat
Thanks Pat,
that worked, even works with time inteligence when selecting slicer dates. I guess what I am seeing now is that your measure is giving the MAXX date and it's using that MAX date -1 to calculate previous month and mine was not. Guessing why that worked, right?
I hope you OK from the concussion from this weekends game (Chiefs).
I appreciate the help!! Good start to the week!