user1403505
user1403505

Reputation: 1005

Start Date and End Date fields to match data studio start and end periods

I am very new to google datastudio. I have set of data from Big Query which has a starting data range and ending date range along with other dimensions shown below

enter image description here

There is a date range filter in datastudio which if set to auto can take date ranges.

How to set the date range to match the UTC time format. 
Will the filter be automatically converted to that format?



 2. **Will the date range will be relative to the start time or the end time or to (both the start time and end time)? The range start date should be matching the start_time in the datasource and the range end date should match the end_time in the datasource? Will that match or is there any way to set that to match to the date range filter? 
**If the start date is within the date range filter, but if the end date is not or viceversa?****

Thanks for your patience and help

Upvotes: 2

Views: 2312

Answers (1)

Keet Sugathadasa
Keet Sugathadasa

Reputation: 13532

If you are using a Date Range filter in Data Studio, you can control the BigQuery query, by adding Date Parameters to your BigQuery query. For this, you need to add Date Time reserved keywords, as follows

  • @DS_START_DATE
  • @DS_END_DATE

An example query would look like this.

SELECT * FROM my_table.my_dataset WHERE start_time > PARSE_TIMESTAMP('%Y%m%d', @DS_START_DATE) AND end_time < PARSE_TIMESTAMP('%Y%m%d', @DS_END_DATE)

As you can see in the above query, you decide what data to be shown, with the reserved keywords. Do not worry about the timestamp as PARSE_TIMESTAMP is capable of converting your timestamp based on the Time format in the dataset.

When adding a Custom Query in Data Studio, for your BigQuery Table, You need to explicitly allow your DATE parameters. Please see the blue color check, in the following screenshot.

enter image description here

With this, feel free to change the Date Range Filter on your Data Studio report, and your query will fetch the required data as per the date range filter.

Upvotes: 3

Related Questions