I have a user view and a login view - the login view contains a ‘count’ measure. I have created a user explore which joins in the login view:
view: user {
dimension: user_id {}
dimension: email_address {}
}
view: login {
dimension: user_id {}
dimension: date {
type: date_time
}
measure: count {
type: count
}
}
explore: users {
join: login {
type: left_outer
sql_on: ${user.user_id} = ${login.user_id}
relationship: one_to_many
}
}
I have one particular user who has logged in eight times. I have filtered the user explore for the user_id to verify this:
user_id | Login Count
06745456|8
This count measure is used in a native derived table (the labs feature introduced in 4.18):
view: user_metrics {
derived_table: {
explore_source: users {
column: login_count { field: login.count }
column: user_id {}
}
}
dimension: login_count {
type: number
}
dimension: user_id {}
measure: count {
type: count
}
}
I would expect the user_metrics explore to return the same results here as it does in the user explore but it does not:
user_id | Login Count
06745456|4
06745456|2
06745456|1
Why does it return three results instead of one? Additionally, why don’t those numbers add up to 8? I’m doing this in order to view a graph where the x axis is the number of logins and the y axis is the number people who have logged in that many times. For example, if I have one user who has never logged in, two users who have logged in once, and one user who has logged in twice:
4|
3|
2| *
1| * *
_________
0 1 2
Why doesn’t the query in my user explore match the user_metrics explore? The user_metrics explore should return the results that the user explore does.