Determine a ratio
Sometimes you may 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:
Define the first measure.
Define the second measure.
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:
Click Explore.
To define the first measure, select the appropriate variables from the dropdown lists. We did the following:
Accept the default count aggregation.
Click events and select user from the dropdown. The text auto updates to Count unique user actors and filtered to all user actors.
Click measure 1 and enter a unique name for the measure. We entered All users.
Click +measure to begin defining measure 2.
For measure 2, select the options from the dropdown lists. We chose to show count unique values of an actor property defined previously, Number of searches. We accepted the filter, Filtered to all user actors.
Click measure 2 and enter a name. We named the measure Searches.
Click +measure to begin defining measure 3. This measure will be the ratio of the first two measures.
In measure 3, click Count, then type an equals sign. Optionally click the arrow to open the Advanced Operations workspace.
Type a left bracket [. A dropdown appears containing the first two measures.
Select the numerator from the dropdown list, then type a slash.
Type a left bracket and select the denominator. Click outside the dropdown to accept the expression.
Accept, or change, the Split By, Starting and Ending values.
Click GO to see results.
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.