I would like to know why this formula does fetch the results I want.
I have a table with:
customer_id | date_booking | booking_status | salon_id |
I want to check if a certain booking of a customer is the first or not, where its considered a successful booking if booking_status = 8 or 14
My Calculated Column was:
If(Calculate(Min(date_booking);filter(table; booking_status = 8 ||
booking_status = 14);filter(table;customer_id = earlier(customer_id);
filter(table;salon_id = earlier(salon_id)))=date_booking;1;0)
Unfortunately the booking_status condition fails here.
I think you need to create a calculated column like this:
IF (
[date_booking]
= CALCULATE (
MIN ( [date_booking] );
FILTER (
ALL ( 'Table' );
[customer_id] = EARLIER ( 'Table'[customer_id] )
&& [salon_id] = EARLIER ( 'Table'[salon_id] )
&& ( [booking_status] = 8
|| [booking_status] = 14 )
)
);
1;
0
)
It will put 1
if the booking was the first with successful status, otherwise 0
.