https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
l

lively-oyster-89205

01/24/2024, 10:29 PM
Hi Growthbook team! I'd like to filter the results of a particular metric such that it will only be calculated for users with a certain status as of the time of the user's enrollment into the experiment. (e.g., I'd like to capture the first payment rate for our subscription service using only users who have not yet made a first payment at the time of their enrollment into the experiment.) I realize that using "Experiment Dimensions" is an option, but it is not quite what I want, as I'd like this filter (prior_payments=0) to only apply to this one metric, not to others, and I don't want whoever runs the experiment to need to remember to apply this dimension to their results in order for the "first payment rate" metric to make sense. I thought Fact Tables would be a nice solution since I could apply filters at the metric level, but I'm not sure how to provide a user status (prior payment count) in a fact table such that it is specific to an experiment (prior payment count will be different for users depending on the experiment launch date). Would greatly appreciate advice on how I can do this / if it is possible. Thanks so much!
f

fresh-football-47124

01/24/2024, 10:30 PM
can prior payment be made generic outside of this specific experiment?
l

lively-oyster-89205

01/24/2024, 10:32 PM
It is a date-specific metric
f

fresh-football-47124

01/24/2024, 10:32 PM
@helpful-application-7107 do you have a good idea for this?
h

helpful-application-7107

01/24/2024, 10:55 PM
Carolyn, do you want the denominator to include all users in your experiment or just those that have never made a payment before?
l

lively-oyster-89205

01/24/2024, 11:02 PM
Hi! Just those who have never made a payment before.
h

helpful-application-7107

01/24/2024, 11:05 PM
Ok, got it. Doing that at the "metric" level will be tough, because in order to filter users out of the denominator as well, you'll basically need either a funnel metric or a ratio metric, both of which would kind of be hacks (especially given that we are still working on explicit funnel metric support in fact tables). This seems like a much better case for Experiment Dimensions, a User Dimension, or even a Segment. Nonetheless, in either case, you'll want to leverage SQL template variables
<https://docs.growthbook.io/app/metrics#sql-templates>
. You can use the
{{ startDate }}
template variable to inject the experiment start date into your SQL. Unfortunately, we don't have a way to use the exposure date itself, but if you're happy with using the experiment start date, you'll at least filter out users that paid before experiment launch, but you will also filter out people that paid between experiment launch -> their own exposure.
I think there may be a way to do this, pretty hackily, using standard (non-fact) metrics, even if you don't want to create a pipeline to pre-compute for each day who has or has not paid before. edit: actually, it's quite difficult because we don't make it easy to create a filter or a denominator metric based on the absence of some values. We should look in to this. You may want to settle for now for: (1) creating a dimension or segment using the
{{startDate}}
template variable (2) be happy just creating a metric filter with that template variable (it won't filter the denominator, though).
l

lively-oyster-89205

01/24/2024, 11:55 PM
Thank you so much for your help, Luke! Yes -- it's a bit tricky since I'm looking for the absence of a payment. I might try spoofing a
no prior payment
"event" to occur each time a user gets enrolled in an experiment. But it is indeed a bit clunky 😛
h

helpful-application-7107

01/25/2024, 12:02 AM
If you're willing to go that route, it's probably better to just ensure that you track something like
no prior payment
alongside payment events and use that as a filter for your denominator in a ratio metric.
l

lively-oyster-89205

01/25/2024, 12:05 AM
OK. And I'll just need to make sure that that those who don't have any payment events still end up in the denominator.
h

helpful-application-7107

01/25/2024, 12:31 AM
Oh yeah, I see. I don't think we have a good way to have that negative filter in the denominator.
👍 1
5 Views