Forum Discussion
anagnostes
9 years agoFrequent Visitor
Memory issues with DAX filter
Hi, I have a model where I have a Customers table and an Orders Table. I want to add a new mesure in the Customers table where i want to compute the average buying cyle. So i add this DAX mesure:...
Bitwize_PowerBI
Advocate IV
9 years agoI think you can do the filter without the earlier() function.
try: FILTER(ORDERS; VALUES('ORDERS'[ORDER_DATE]) >= 'ORDERS'[ORDER_DATE] ) && VALUES('ORDERS'[ID]) <> 'ORDERS'[ID] )
as you cycle through all of your orders, you could create a calculated column in your orders table to get the 'previous order date'. You would have to add a condition for 'the same customer':
CALCULATE (
MAX ( 'ORDERS'[ORDER_DATE] ) ;
FILTER(ORDERS; EARLIER('ORDERS'[ORDER_DATE]) >= 'ORDERS'[ORDER_DATE] ) && EARLIER('ORDERS'[ID]) <> 'ORDERS'[ID] && EARLIER('CUSTOMER'[ID]) = 'CUSTOMER'[ID])
)
Regards,
Dries