Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the article How to use a custom query to access your BigQuery data? you have learned how to create a custom query. In this tutorial we will now show how to use this custom query to create a data source in the Google Data Studio. This data source can then be used to create interesting reports.

Parameterize Custom Query

Google Data Studio supports the concept of parameterized custom queries. Parameterized queries have the advantage that they are more efficient than general queries, since only the data that is really necessary is queried. In an SQL query, placeholders are set which are then filled with values at runtime. A parameter could be a date field, for example. If the user changes a date filter in a report, the correct values are inserted into the query when the query is run.

...

The WHERE part of the SQL query is filtered by the field "trackedAt". This is the partitioning key. This value must lie between @DS_START_DATE and @DS_END_DATE. These two parameters are placeholders used by Google Data Studio. But also other analysis software uses exactly these placeholders for time periods. Furthermore, it is important that the LIMIT statement is removed.

Create a data source in Google Data Studio 

Navigate to Google Data Studio to the “Data sources”. Here you can create a new data source.

...