I have an existing query of transactions where fuel has been received by any particular airline for any given date.
An airline can receive multiple fuel transactions per day.
I need to find the SUM of fuel received for each airline; only for the very last day they received it, within the given time period.
I can pull the last transaction date for each airline using the Last function. (see table below for example; though I need to make sure this only happens for values in the received column.)
The problem I'm having is trying to get the correct GallonsReceived for each airline (group) on only the last date they received fuel for that particular timeframe.
Example in the attached photos:
For testing, I'm running the query for dates between 12/01/20 through 12/31/20.
On 12/31/20, there happens to be only one received transaction per airline.
The other photo shows the last date of each airline had a transaction. (though I need to make sure this only happens for values in the received column).
Example db is attached. Thanks for your help!
An airline can receive multiple fuel transactions per day.
I need to find the SUM of fuel received for each airline; only for the very last day they received it, within the given time period.
I can pull the last transaction date for each airline using the Last function. (see table below for example; though I need to make sure this only happens for values in the received column.)
The problem I'm having is trying to get the correct GallonsReceived for each airline (group) on only the last date they received fuel for that particular timeframe.
Example in the attached photos:
For testing, I'm running the query for dates between 12/01/20 through 12/31/20.
On 12/31/20, there happens to be only one received transaction per airline.
The other photo shows the last date of each airline had a transaction. (though I need to make sure this only happens for values in the received column).
Example db is attached. Thanks for your help!