I am trying to set up a query for a metric but som...
# ask-questions
o
I am trying to set up a query for a metric but something got me confused. The text under Example SQL explains that value is the "number of conversions" for this user_id, but the "timestamp" is the "the time the action was performed". So what's the best way to store the metric data? Aggregated or raw? It's a revenue-based metric, then the "value" would represent the order sum
f
The metric data should usually be stored as one row per conversion event. The
value
would be the amount of the conversion event. And then if there are multiple conversion events for a user during an experiment, we sum the values together.
We have a GitHub issue open to allow changing the default SUM behavior when there are multiple conversion events for a user. That should allow a lot more flexibility in how you store metric data (for example, getting the max or average instead of the sum) https://github.com/growthbook/growthbook/issues/132
o
If I choose the metric type "Count" but the values are different in conversion events, would the framework count all the rows per user or try to sum the "value" field ?
f
It will sum the
value
field. If you want it to count the rows instead, you could select
1 as value
The only real difference between count, revenue, and duration metrics are how we format the values when we display them