Hi team. Im thinking about what if I have two metr...
# ask-questions
g
Hi team. Im thinking about what if I have two metrics which are
amountOfClick
and
income
,both data are from the same table. But there's only one
value
column in the table. In that case how do we define the
value
? or how do we query the metric?
w
I'm not sure exactly what your data looks like or what amountOfClick and income are supposed to mean. One guess is that every time someone purchases something you send another row to your table with the value being the amount of money of that purchase. Perhaps you want to know 1. the average order amount which would be a "revenue" type metric
Copy code
SELECT
 user_id,
 amount as value,
 received_at as timestamp
FROM
 purchase
as a SUM where the denominator is "orders per user" 2. the total revenue per user which would also be a "revenue" type metric
Copy code
SELECT
 user_id,
 amount as value,
 received_at as timestamp
FROM
 purchase
as a SUM where the denominator is "All experiment users" 3. or perhaps just the orders per user which would be a "count" metric:
Copy code
SELECT
 user_id,
  received_at as timestamp
 1 as value
FROM
 purchase
where the denominator is "All Experiment users" All of which could be gotten from the same table. Does this answer your question?