I want to use one query to get the distinct count of monthly, weekly and daily users in one query. Currently,I am using three different data sources with the following fields:
**To calculate Monthly Active Users, I am using the following select statement: **
cast(CONCAT(cast(year(date(date))as varchar),'', cast(month(date(date)) as varchar),'','01') as date) AS date,
mobile_app_os,
CASE country WHEN 'DE' THEN 'Germany' ELSE 'International' END AS country,
count(distinct app_user_id) as MAU
**To calculate Weekly Active Users, I am using the following select statement: **
CAST(date_parse(CAST(year_of_week(date(date)) AS varchar) || ':' || CAST(week(date(date)) AS varchar), '%x:%v') AS date) as date,
CASE country WHEN 'DE' THEN 'Germany' ELSE 'International' END AS country,
mobile_app_os,
count(distinct app_user_id) as WAU
**To calculate Daily Active Users, I am using the following select statement: **
CAST(date(date) AS DATE) as date,
mobile_app_os,
CASE country WHEN 'DE' THEN 'Germany' ELSE 'International' END AS country,
count(distinct app_user_id) as DAU
I query the data data using Presto connector in Tableau and then use tableau to join these different data sources to calculate DAU/MAU, WAU/MAU and DAU/WAU ratios.
It would be super convenient to have these data sources in one query because joining more than two data sources in Tableau is not a good idea.