Working with dates with BigQuery


#1

This is my solution to getting a specific period of time I want for example Monthly Active Users (MAU) using BigQuery Syntax:

SELECT dt AS date,
count(distinct(UserId)) AS MAU
FROM Login
WHERE dt >= date_sub(current_date(), interval 30 DAY)
GROUP BY dt

This query will check what was the first date to start counting from 30 days ago and take everything between that date and current date.