Chapter 14: Working with Dates, Embedding Content, and Extracting Data
14.2. Calculating Membership Duration with CURRENT_DATE()
In this lesson, we're going to focus on calculating the duration between the time when a user becomes a paid member and today. This can serve as a custom dimension to understand the average age of your paid members or track how long it takes for someone to upgrade from a paid member to another membership level, like a gold member, within your database.
Using CURRENT_DATE() Function
In the previous lesson, we learned that by using DATE_DIFF()
function we can calculate the difference between two dates. To calculate membership duration, you need to find the difference between the start date (when the user becomes a paid member) and the end date, which in this case is today. In Looker Studio, we have a function called CURRENT_DATE()
, which returns the current date without needing any input.
You can, however, provide a time zone input, but it is not necessary for the function to work. This function can return today's date in either a string version of the time zone or the actual difference between UTC and the desired time zone.
Calculating Membership Duration in Weeks
Using the CURRENT_DATE()
function, we can calculate the difference between today and the start date by dividing the result by 7, which gives us the membership duration in weeks.
This calculation offers a more accurate and dynamic method for determining membership durations as opposed to hardcoding the data during the data collection process. Before Looker Studio, some companies would calculate the days using separate scripts, then push the date as a custom session-level dimension in Google Analytics. However, Looker Studio allows for more precise and flexible reporting, and the calculation can be applied retroactively.
Take note of these advantages when working with membership durations, as they allow you to better analyze and understand your users' behavior and membership status over time. Keep in mind that it's always better to use a flexible calculation method, like the one demonstrated in Looker Studio, rather than hardcoding values for a more meaningful analysis.
Later, we will cover how to use DATETIME_DIFF() function in Looker Studio, to determine the difference between two specific dates.
📩 Receive my weekly Looker Studio tips
🖇 Connect with me on LinkedIn