days since last orders =
VAR currentCustomers = MAX('stats de vente'[client])
VAR currentDate = 'stats de vente'[date]
VAR lastOrderDate =
CALCULATE(
MAX('dim date'[Date]),
FILTER(
ALL('stats de vente'),
'stats de vente'[client] = currentCustomers &&
'stats de vente'[date] < currentDateDate
)
)
RETURN IF(lastOrderDate = BLANK(), BLANK(), currentDate - lastOrderDate)
i have this error It is impossible to determine a unique value for the “customer” column in the “sales stats” table. This can occur when a measurement formula refers to a column that contains many values, without specifying an aggregation such as min, max, count, or sum to obtain a single result.
I would like to have the number of days elapsed between two customer orders.
I think the issue here is
var currentDate. It needs to have one value, so try: