I’m working with data from an email log that notifies a customer each week of the status of items that are on backorder. I’m trying to create a measure that shows the MAX time a customer has waited for the product based on an applied date filter.
The log includes a numeric field for “DaysOnBackorder”, so the DAX I’ve written looks like this:
MAX Days Pending =
VAR CurrentItem = SELECTEDVALUE(BackorderLines[Item Nbr])
RETURN
CALCULATE(
MAXX(
FILTER(ALL(BackorderLines), BackorderLines[Item Nbr] = CurrentItem),
BackorderLines[DaysOnBackorder]),
USERELATIONSHIP(BackorderLines[DateSent],Dates[Date]))
This returns the correct value if there isn’t a date range selected as a filter. However, when I apply a filter to the page, the data is still returning the MAX value for dates not in the filter. How do I modify the DAX to recognize the filter?
MAX Backorder Last 7 Days.pbix (180.4 KB)