For many businesses, understanding how far in advance users make purchases is key to analyzing their behavior and planning. This knowledge is especially valuable in sectors such as events, hospitality, services, catering... where anticipating customer decisions can make all the difference in strategic planning and resource optimization.
In this article, I will show you how to calculate this value using Looker Studio with a field that measures the difference in days between the purchase date and the session date. So for that, it will be essential to have an event parameter configured that tells us the session/booking date.
Before you begin, you need to confirm that both date fields (the date of purchase and the date of the session/booking) are set correctly as type "Date."
To verify:
PARSE_DATE("%d/%m/%y",date_session)
This step will transform the date_sesion field into a value recognizable as a date.
Once both fields are correctly set as dates, you can calculate the anticipation in days between the purchase date and the session date.
To do so, follow these steps:
Enter the following formula to calculate the difference in days:
DATE_DIFF(PARSE_DATE("%d/%m/%y", date_sesion), Date)
Note that in this formula Date represents the date of purchase and date_sesion is the session date or the day for which the user has made the purchase.
Step 3: Interpretation of the results
If everything went correctly, the resulting value in the "Days in Advance" field shows us how many days before the session date the user made the purchase:
With this calculated field we will be able to create tables or charts in Looker Studio to analyze user patterns and extract interesting insights.