Hello team, I have a fact table defined like this:...
# ask-questions
n
Hello team, I have a fact table defined like this:
Copy code
SELECT 
  user_id,
  timestamp,
  event_count_in_session as actions_per_session,
  session_id
FROM `test_project.test.test_user_sessions`
WHERE timestamp >= '2025-06-16 00:00:00'
And I have metrics defined like the first picture attached. I want to aggregated the metrics based on experiment variant id during the experiment running window. So according to the ExperimentResults query SQL in the picture, does I have the experiment_users table for free? Or do I have to create my own experiment_users table?
Copy code
SELECT
  variation,
  -- Total metric value
  SUM(m.value) as numerator,
  -- Number of users in experiment
  COUNT(*) as denominator,
  -- Final result
  numerator / denominator AS value
FROM
  experiment_users u
  LEFT JOIN metric m ON (m.user = u.user)
GROUP BY variation
h
experiment_users is a placeholder table name for the users we get from your Experiment Assignment Query defined under your Datasource. That is where you define the SQL that captures all of your exposure events.
n
Thanks! Is there an easy way to log them in the backend sdk?
h
Look for the
tracking callback
section in your sdk documentation: https://docs.growthbook.io/lib/node#experimentation-ab-testing You should use whatever logging function you use for most of your events and log the experiment and variation ids as shown in the examples.
n
Thank you so much! Your answer is very helpful after I asking AI in multiple ways but could not figure it out!
🙌 1