When using the Two Minute Reports’ PostgreSQL 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.
![](https://twominutereports.com/help/wp-content/uploads/2023/11/Screenshot-from-2023-11-21-08-51-09-copy.png)
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 PostgreSQL’s SQL date ranges from Looker Studio’s date range control. Let’s see how to use them:
Steps
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”:
![](https://twominutereports.com/help/wp-content/uploads/2023/11/Screenshot-2023-11-27-101632.png)
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:
![](https://twominutereports.com/help/wp-content/uploads/2023/11/Screenshot-2023-11-27-101726.png)
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.