Have you ever gotten tired of manually labelling dates in your reports as "Current Month," "Last Month," or "X Months Ago"? It can be a tedious task, especially if your reports are updated frequently.
Well, there's good news! This blog post will introduce you to a powerful solution: creating a calculated field. This field will automatically determine the relative position of a date compared to the current date, eliminating the need for manual relabeling.
CASE
WHEN EXTRACT(MONTH FROM CURRENT_DATE()) = EXTRACT(MONTH FROM Date ) THEN 'Current Month'
WHEN EXTRACT(MONTH FROM CURRENT_DATE()) - 1 = EXTRACT(MONTH FROM Date) THEN 'Last Month'
ELSE CONCAT(EXTRACT(MONTH FROM CURRENT_DATE()) - EXTRACT(MONTH FROM Date), ' months ago')
END
This formula uses the CASE statement to analyse the relationship between the current date and the date you're interested in (represented by the field named "Date" in this example).
Example:
Imagine it's July (month 7) and you're analysing data for May (month 5). The formula would calculate the difference (7 - 5) and display "2 months ago" in the report.
Benefits:
WEBINAR on Data Storytelling with Looker Studio
Join the live session with experts from AnalyticsLiv.
Turn data into stories that drive action!
WEBINAR on Data Storytelling with
Looker Studio
📅 31 July 2025
⌛ 8:00 PM IST / 7:30 AM PST