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
- Open the table containing your products.
- Click the Join button.
- Click the the table containing transactions.
- Click done. Trevor will bring in the data, matching the rows with the relevant product.
- ⚡Important: do you need to filter out incomplete or cancelled transactions?
- Next, click the calculate button. The calculate modal will open.
- In the calculations(s) section, click the plus icon and then select count transactions (or whatever the word for transactions is in your database).
- In the group by section, select products.
- In the Include other columns section that appears, click the names of any columns you want to include in the results.
- Click Done.
(2) Counting transactions by product, per month
- Follow the instructions above.
- When choosing your group by options in step 8, add the column containing the date each transaction took place before adding products.
- 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.