Help Creating a Complex Filter Condition
I have a table that contains payment transactions. The fields in the table that I need in my report include Vendor Name, CardTokenNumber, PaymentStatus. I did not design this table and the issue I'm having is that there is a record for each CardTokenNumber (unique value but not unique in the table) and if the payment is successful, the PaymentStatus will be TRUE and there will only be 1 record in the table for the CardTokenNumber. If a payment fails, the 1st record's PaymentStatus will be FALSE and another record for the CardTokenNumber is added to the table for the payment to be tried again. Records will be added for the CardTokenNumber until the payment is successful at which point the last record added for the CardTokenNumber will be TRUE or eventually it will be determined that the payment cannot be made and the last record for the CardTokenNumber will be FALSE.
I need to generate a report that shows the success rate (regardless of how many attempts there are) for a Vendor. I want to filter the data so it only shows the most recent record for a token and then I can group by the Vendor Name which I can then count the number of PaymentStatus = TRUE (for successful payments), number of PaymentStatus = FALSE (for unsuccessful payments (ignoring the number of tries)), and generate a successful percentage rate (Count of PaymentStatus = TRUE / (Count of PaymentStatus = TRUE + Count of PaymentStatus = FALSE).
I need help creating the filter. This report is needed quickly so any help the community can provide will be greatly appreciated. I've spent hours using Gemini to try and solve for this but it turned into a complete waste of time :-(