Posts

Showing posts with the label powerbi

How to create a DAX measure for finding values in a previous month, not using a Date field?

How to create a DAX measure for finding values in a previous month, not using a Date field? I am currently trying to create a report that shows how customers behave over time, but instead of doing this by date, I am doing it by customer age (number of months since they first became a customer). So using a date field isn't really an option, considering one customer may have started in Dec 2016 and another starts in Jun 2017. What I'm trying to find is the month-over-month change in units purchased. If I was using a date field, I know that I could use [Previous Month Total] = CALCULATE(SUM([Total Units]), PREVIOUSMONTH([FiscalDate])) I also thought about using EARLIER() to find out but I don't think it would work in this case, as it requires row context that I'm not sure I could create. Below is a simplified version of the table that I'll be using. ID Date Age Units 219 6/1/2017 0 10 219 7/1/2017 1 5 219 8/1/2017 2 4 219 9/1/2017 3 12 342 1...