OneWoven

Check the number on the dashboard

Free lesson 2 of 3: Find where the extra orders came from

Turn your phone sideways for a larger picture.

Lesson notes

The principle

A paid order and a payment attempt answer different questions. Write down what one row represents before joining two tables. If the report needs one row per order, decide which payment evidence qualifies the order, then reduce payment records to one qualifying row per order before counting. Include a tie-out to the source and check that orders with no payment attempts are dealt with deliberately.

Work through an example

Order A17 has a failed attempt followed by a successful one. Order A18 has one successful attempt. An inner join of orders to all attempts returns three rows, but these represent two paid orders. Filtering to successful attempts fixes this small example. Counting distinct qualifying orders also protects the measure when more than one successful payment record can refer to the same order.

Practise before reading the feedback

The attempts table shows B21 unsuccessful, B21 successful, B21 successful and B22 unsuccessful. The orders table contains B21 and B22. Under the rule that a paid order has at least one successful attempt, report the paid-order count and name the mistake that would produce two.

Your response is for practice and is not saved.

Review worked feedback

The count is one. Only B21 qualifies. Counting successful attempt rows produces two. Group by order ID or count distinct order IDs after filtering to successful attempts. Ask the payments team separately why two successful records exist. That matters to the cash reconciliation, even though it does not change the paid-order count.