Using Dynamic Dates In MySQL Connector


When using the Two Minute Reports’ MySQL connector in Looker Studio, you might want to apply the date range selected within your report directly to the underlying SQL query.

While Looker Studio itself can filter data based on selected date ranges, dynamically passing this range directly to the SQL query can speed up report loading. This is because the connector doesn’t need to fetch the entire table, letting Looker Studio handle the data filtering. And modifying the query config and adjusting the filter date range manually can be time-consuming.

For this purpose, Two Minute Reports offers a convenient solution: the use of parameters such as @startDate and @endDate within the Looker Studio report.

Using this feature, you can control your MySQL’s SQL date ranges from Looker Studio’s date range control. Let’s see how to use them:


1. Connect to your data source and set up your query as usual. If you haven’t done this yet, please check out this guide.

2. Consider a scenario where you have the following SQL query in your query config, pulling all rows from a table named “orders”:

3. Now, if you want to apply a date range selected in the Looker Studio report to this SQL query, modify your query config and your SQL query. Add a WHERE clause with @startDate and @endDate parameters like below and save your query config:

Now, each time your Looker Studio report refreshes, the selected date range in the report will be dynamically passed to your SQL query, making your report load much faster.

We believe this feature is helpful to you, and we’re eager to hear your feedback on how it could further improve your reporting experience. If you have any questions or suggestions for additional features, please reach us at our support here.

Tags: ,

Was this helpful?