<\/figure><\/div>\n\n\nNote that I did not choose a specific date, but rather wrote it as:<\/p>\n\n\n\n
events_*<\/code><\/pre>\n\n\n\nand then<\/p>\n\n\n\n
where _table_suffix between format_date('%Y%m%d', date_sub(current_date(), interval 30 day)) and format_date('%Y%m%d', current_date())<\/code><\/pre>\n\n\n\nThat means the last 30 days.<\/p>\n\n\n\n
\nA note for advanced users:<\/strong><\/p>\n\n\n\nToday’s and yesterday’s table are in events_intraday until they are processed and only then are they transferred to events, so if you really want to be on the safe side it is better to use<\/p>\n\n\n\n
where REGEXP_EXTRACT(_table_suffix, r'[0-9]+’) between format_date(‘%Y%m%d’, date_sub(current_date(), interval 30 day)) and format_date(‘%Y%m%d’, current_date())<\/p>\n\n\n\n
Then it will query both events and events_intraday.<\/p>\n<\/blockquote>\n\n\n\n
Now, this screen will open up on the side:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\n\nName your query<\/li>\n\n\n\n Set a schedule of the query’s run: how often (I chose daily), at what time (pay attention to the time zone), and when the schedule will start and end.<\/li>\n\n\n\n Set the location of the new table – Mark the checkbox Set a destination table<\/em>, and then under Dataset <\/em>start writing the name of your dataset, and under Table Id give your table a memorable name.<\/li>\n\n\n\nChoose whether the new query will overwrite the existing table, or just add to it. I chose to overwrite so that if any new schema (i.e. columns) enters – it will be included in the table.<\/li>\n<\/ol>\n\n\n\nThat’s it. Now click save and your query will appear here:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nAfter your query runs, you can find the new table under your dataset, and you can see that the new table only contains the few fields we selected:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nIf you click on details you can see that the table is significantly smaller, in this case, it’s only 463MB:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nAnd this compared to the original table, which is 700MB for one day of data:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nAnd back to Looker Studio:<\/p>\n\n\n\n
Now we have 2 options to bring the data to Looker Studio.<\/p>\n\n\n\n
Option 1 – Select the new table we created<\/h3>\n\n\n\n
<\/figure><\/div>\n\n\nAfter selecting the new table, I went to Personal History to see how much the query “cost us”, and I can see this:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\n
<\/figure><\/div>\n\n\nAnd this is what it looks like in Looker Studio:<\/p>\n\n\n\n
Of course, I added an option to select dates, and every time I change a date – it uses the existing data that was downloaded when I connected the table and does not run a new query to BigQuery:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nOf course, you have to remember that if I select dates from before the last 30 days – the report will not show anything, because our BigQuery table only contains the last 30 days each time.<\/p>\n\n\n\n
You can change this of course, but it means your basic query will consume more data.<\/p>\n\n\n\n
Option 2 – run a custom SQL query on the new table<\/h3>\n\n\n\n We’ll just do a SELECT * from the new table, only this time we’ll have to insert the parameters @DS_START_DATE and @DS_END_DATE for our date to work, otherwise, it’s just <\/p>\n\n\n\n
will take the table as it is and will not change anything even if we change dates:<\/p>\n\n\n
\n
<\/figure><\/div>\n\n\nAn important final note<\/h2>\n\n\n\n In the examples listed here, I only referred to a single report.<\/p>\n\n\n\n
Although it was heavy, my table contained only 4 columns except for the date, which is a very simple use case.<\/p>\n\n\n\n
When creating an entire dashboard that is based on data from BigQuery, it is, of course, advisable to plan it differently, and perhaps create a query that builds all the columns, then in Looker Studio you simply select the columns you want.<\/p>\n\n\n\n
This will of course affect the way you want to bring the data to Looker Studio – whether to bring the entire table or use a custom SQL query.<\/p>\n\n\n\n
Another important thing to note is that your scheduled query will run at the frequency you set and consume gigabytes, even if no one actually enters the reports.<\/p>\n\n\n\n
That’s why you should optimize it from time to time and remove any redundancies.<\/p>\n\n\n\n
In my case, it consumes about 15GB per day. It’s not much – but it’s a shame that it will just run if no one uses it.<\/p>\n","protected":false},"excerpt":{"rendered":"
Originally published in Hebrew on the Lixfix blog Google’s Looker Studio, previously called Data Studio, was one of the most useful tools for anyone using Google Analytics. I write “was” because, on November 10, 2022, Google dropped a bomb when they applied multiple restrictions that make it difficult to build the reports. In short, Looker […]<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-5563","post","type-post","status-publish","format-standard","hentry","category-google-data-studio"],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=5563"}],"version-history":[{"count":6,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5563\/revisions"}],"predecessor-version":[{"id":6089,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5563\/revisions\/6089"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=5563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=5563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=5563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}