Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- [Play_Time]/[Sessions] as Session_Duration
- from(
- select
- sum ([T_Sessions]) / sum ([DAU]) as Sessions,
- sum ([T_SessionDuration]/60) / sum ([DAU]) as Play_Time,
- from(
- Select *
- from(
- select
- sum (allData.SessionDuration) as T_SessionDuration,
- COUNT(DISTINCT allData.SessionNumber) as T_Sessions,
- from(
- Select
- allData.SessionNumber,
- allData.distinct_id,
- allData.SessionDuration,
- allData.eventDate
- FROM
- (
- SELECT
- *,
- Date(time) as eventDate
- FROM TABLE_DATE_RANGE([cat-force-bi-19:EVENTS.FACT_], TIMESTAMP('2019-10-01'), TIMESTAMP('2019-10-22'))
- where version >= "0.2.0" and event = "Session_End"
- ) allData
- )
- group by allData.distinct_id, allData.eventDate
- ) DU_Data,
- (
- Select
- Count(distinct allData.distinct_id) as DAU,
- allData.eventDate
- FROM
- (
- SELECT
- *,
- Date(time) as eventDate
- FROM TABLE_DATE_RANGE([cat-force-bi-19:EVENTS.FACT_], TIMESTAMP('2019-10-01'), TIMESTAMP('2019-10-22'))
- where version >= "0.2.0" and event = "Session_End"
- ) allData
- group by allData.eventDate
- ) DAU_Data
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement