How do I create a relationship between departure and arrival to show only vehicles that are still av

I created an app to control vehicle departures. I have the following tables: departure, arrival and vehicle. In departure, there is a status that can be (departure or arrival) and it references the vehicle table through the vehicle id. When I click to select the vehicle I want to leave, it shows all vehicles. My problem is that when a vehicle has already left, I don’t want to show that vehicle, since the status was not identified as arrived. How do I create a relationship between departure and arrival to show only vehicles that are still available to leave.

Hi,

You do not indicate the architecture of the departure/arrival table, but assuming that you have a scheduled departure and arrival date for each vehicle, let’s go;

1*- creates a virtual column name e.g. “available” of type yes/no in the vehicle table with the function,

COUNT(
    SELECT(
        Departure Arrival[Id],
        AND(
        today() >= [Exit Date],
        today() <= [Entry Date]
        )
    )
) = 0

2- create a slice e.g. “vehicles availables” of the vehicles table with the function

[Available]="Y"

3- create a view on the slice

1 Like