Skip to main content


Scuba Docs

Determine a ratio

Many businesses want to determine the ratio between two events:

  • A measure assigns a value to a set, which is interpreted as its size.
  • A ratio is the relationship between two measures, indicating how many times the first measure contains the second. 
This article demonstrates how to construct a query using two measures, then how to determine the ratio between the two measures.

How to determine the ratio between two measures

This section demonstrates how to create a query that determines a ratio between two measures. In our example, we want to determine the number of unique users who watched movies over the last 200 days, and the ratio of movies watched to the number of unique users.

Determining a ratio between two measures involves three steps:

  1. Define the first measure.
  2. Define the second measure.
  3. Define a third measure that is the ratio of the first two measures.
To create a query that determines a ratio between two measures, do the following:
  1. Click Explore
  2. To define the first measure, select the appropriate variables from the dropdown lists. We did the following:
    1. Accept the default count aggregation.
    2. Click events and select username from the dropdown. The text auto updates to Count unique username actors and filtered to all username actors.
    3. Click measure 1 and enter a unique name for the measure. We entered All users.
      Screen Shot 2020-03-18 at 6.09.03 PM.png
  3. Click +measure to begin defining measure 2.
    1. For measure 2, select the options from the dropdown lists. We chose to show count unique values of an actor property defined previously, Movies watched over the last 200 days. We accepted the filter, Filtered to all user actors
    2. Click measure 2 and enter a name. We named the measure Movies watched.
  4. Click +measure to begin defining measure 3. This measure will be the ratio of the first two measures.
  5. In measure 3, click Count, then type an equals sign. Optionally click the arrow to open the Advanced Operations workspace.
    Screen Shot 2020-03-18 at 7.10.52 PM.png
  6. Type a left bracket [. A dropdown appears containing the first two measures.
    Screen Shot 2020-03-18 at 7.14.26 PM.png
  7. Select the numerator from the dropdown list
  8. Type a slash.
  9. Type a left bracket and select the denominator. Click outside the dropdown to accept the expression.
    Screen Shot 2020-03-20 at 5.17.41 AM.png
  10. Accept, or change, the split by, Starting and Ending values.
  11. Click GO. We received the following results for our example.
    Screen Shot 2020-03-20 at 5.20.41 AM.png

More information

See Calculate measures and filters for information about building expressions.

What's Next

Now that you've created a query to determine a ratio, you can move on to analyzing user sessions with flows.

  • Was this article helpful?