There are two ways of counting your data in Trevor. 

(1) Count unique values of....

You can count unique values of a particular thing.

For example:

  • count(transactions)
  • count(orders)
  • count(users) etc.

What Trevor does behind the scenes is count the unique IDs associated with each of these entities.

To do this:

  1.  Click the Calculate button. 
  2. In the Calculations(s) section, click the plus icon.
  3. If Trevor has detected any specific items you can count, they will appear at the top:

Don't see any suggestions? 

If you scroll down, you'll see count unique values of ... in the list of options. If you click this, you'll be able to manually select the thing you want to count. 

(2) Row count

If you click the header of a given column, the third option down menu is count

If you click it, it will open the Calculation modal, with row count preselected in the Calculation(s) section and the name of the column you clicked on preselected in the Group by section.

What row count does is count the number of rows that contain each of the unique values in a given column. 

It's a great way to get quick answers from single tables, like:

  • count users by sign up date.
  • count users by country.
  • count products by price etc.

The risks

Once you've started joining multiple tables together, it becomes a little trickier to use the row count function. 

For example, if you join your Users table, your Transactions table, and your Products table, you'll most likely end up with multiple rows per transaction and per user (assuming that a transaction can contain multiple products and a user can have multiple transactions). 

Using row count at this point to, say, count your customers, will produce the wrong answer because, as mentioned above customer information is now duplicated on multiple rows. 

You should therefore use the count unique values of ... option. 

Does that make sense? Let us know if not :)

---------

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?