In this article, I cover how to:

  • Count transactions by product
  • Count transactions by product, for each month

For the purposes of this article, I'm going to assume that a direct relationship exists between the table containing your transactions and the table containing your products. I'm also going to assume that each transaction only has one associated product. If that's not the case, just reach out and we'll help 🙂

(1) Count sales by product

  1. Open the table containing your products.
  2. Click the Join button. 
  3. Click the the table containing transactions.
  4. Click done. Trevor will bring in the data, matching the rows with the relevant product. 
  5. ⚡Important: do you need to filter out incomplete or cancelled transactions?
  6. Next, click the calculate button. The calculate modal will open. 
  7. In the calculations(s) section, click the plus icon and then select count transactions (or whatever the word for transactions is in your database).
  8. In the group by section, select products.
  9. In the Include other columns section that appears, click the names of any columns you want to include in the results. 
  10. Click Done

All done!

(2) Counting transactions by product, per month

  1. Follow the instructions above
  2. When choosing your group by options in step 8, add the column containing the date each transaction took place before adding products
  3. In the date dropdown menu that appears, select month (you can also select day, week, and year).

All done! If you secretly run a marketplace for giant beanbag chairs in your spare time, like I do, your results may look something like this:

---------

A common question

Why start from the Products table rather than the Transactions table?

If you start from the transactions table and perform a left join (the default in Trevor), you'll lose any products that have 0 sales. This is because, if a product isn't associated with any transactions, it won't be brought in and so won't be included in any calculations you perform.

You could perform a right join instead, but it's easier just to start from the products table in this case.

---------

Have a question?

We're on standby to help! To chat with us, click the blue Intercom button in the bottom right of Trevor's interface.

Did this answer your question?