Are you using Looker as your business intelligence tool and seeking a streamlined approach for period-over-period comparison? If you’re aiming to minimize time spent on coding, we offer a solution tailored to your needs. With our methodology, integrating period-over-period comparison into your Looker project will take less than 10 minutes.

We’ve developed a comprehensive toolkit available on GitLab, which can be seamlessly integrated into all your projects. This toolkit includes various methods for period-over-period analysis, each implemented following the Methods for Period Over Period (PoP) Analysis in Looker documentation. This ensures flexibility, allowing you to choose the method that best suits your requirements.

Our approach eliminates the need for you to implement period-over-period comparison from scratch. Simply follow these straightforward steps.

Screenshot of a Git repository interface showing the 'looker-toolkit' project. The page displays a directory with folders and files, including 'period_over_period' and 'README.md', with recent commit messages like 'pop documentation part' and 'pop url modification'. The README.md preview below lists contents and describes the Astrafy Kit designed to facilitate LookML code implementation, highlighting its current features and ongoing development.

A Step-by-Step Guide

Let’s consider a scenario where you have a Google Analytics sessions view file in Looker with a “date” field and wish to use method 6 (comparison between two arbitrary periods) for period-over-period comparison.

Connect to remote repository
Copy and paste the provided code snippet into your project manifest.

remote_dependency: astrafy_kit {
  url: "https://gitlab.com/a10969/looker-toolkit"
  ref: "master"
}
A snippet of a manifest.lkml file from a Looker project, containing code to define a remote dependency named 'astrafy_kit'. It includes a URL pointing to a GitLab repository and specifies the 'master' branch as the reference.

Update dependencies
Click on “Update Dependencies” to import the remote project.

Interface buttons for 'Recheck Errors' with a refresh icon and 'Update Dependencies' in orange, along with tabs for 'Quick Help' and 'Metadata' in a software development environment

Imported Folder
A new folder named “imported_projects” will automatically appear. It will detect automatically new versions of the remote project.

A file browser window showing a directory structure with a folder named 'imported_projects' expanded to reveal a subfolder called 'astrafy_kit', followed by other folders named '1_views' and '2_explores'.

Include
Include the relevant file from the imported project into your view file using the filename and project name as shown below.

include: "//astrafy_kit/period_over_period/pop_method_6.lkml"

Extend
Enhance your view by adding the “extends” to employ period-over-period analysis:

view: +fc_sessions {
  extends: [period_over_period]
  
  ## Custom dimensions and measure
    
  ##
}

Date Dimension
Define your date dimension for period-over-period analysis in your view file.

dimension_group: created_pop {
  type: time
  label: "Creation Date UTC"
  description: "Creation Date UTC"
  datatype: timestamp
  sql: TIMESTAMP(${date_raw}) ;;
}

Compare your data
That’s it! Now you can effortlessly create visualisations leveraging the remote project where period-over-period comparison has been implemented.

Analytics dashboard with a line graph comparing two different time periods, labeled 'First Period' and 'Second Period'. The graph is part of a data exploration interface with filters set for specific date ranges, and additional options for data manipulation like 'Add calculation'. Below the graph, tabulated data and SQL query tabs are visible, indicative of a business intelligence tool


Conclusion

This methodology is used here for the period-over-period feature, but the “imported_projects” allows for flexible reuse of model files, view files, and more across multiple projects. Consider the scenario where you wish to use some views across multiple projects; rather than resorting to copy-pasting and the subsequent maintenance overhead, you could opt for this streamlined approach where you maintain your views in a single location.

Thank you

If you enjoyed reading this article, stay tuned as we regularly publish articles on Looker and how to get the most value of this tool. Follow Astrafy on LinkedIn to be notified for the next article ;).

If you are looking for support with your Looker implementation, advice on Modern Data Stack or Google Cloud solutions, feel free to reach out to us at sales@astrafy.io.