Looker Studio's YouTube integration doesn't include a 'Date Published' field. But it's possible to create one yourself as a calculated field. Here's how!
A while back, I wrote an article on exporting YouTube video data using Looker Studio (formerly Google Data Studio). One of the commenters on that article asked:
How do I basically summarize all of the views for the video while being able to see the video's publishing date in the report?
This is such a great question that I thought it deserved its own article: this one.
I'm going to assume you've already created a Looker Studio report and added your YouTube channel as a new data source. If you haven't, then please follow the instructions on my previous article.
The YouTube Analytics data source does have a 'Date' field out of the box (as well as 'Date Time'), but this is the date that any activity took place. So for example, if you create a simple chart with Video Title and Date as dimensions, and Views as the metric, you'll get something like this:
This tells me that the video got 5 views on 5 May, 1 view on 6 May, and so on. This could be useful, but it doesn't tell me when the video was published.
However, knowing the first day that each video received a view would be a great proxy for the video 'Published Date' (as almost all videos receive their first view on the day they were published).
So, although the YouTube Analytics data source doesn't have a 'Published Date' field, we can effectively create one using the information in the 'Date' field.
This new field can either be a chart field on one particular chart, or a calculated field within your data source that can be applied to lots of different charts. Let's look at each approach in turn.
PARSE_DATE("%Y%m%d",MIN(Date))
The formula does two things. First, it takes the Date field and uses MIN() to find the minimum value (i.e. the oldest date, the first day that the video received a view).
This is returned as a numeric output (i.e. a number), which would be usable but not really what we want. So the formula then uses PARSE_DATE() to turn that number back into a date.
NB: Although Looker Studio defaults to a type value of 'Text' for this new field when you are creating it, if you edit it again you will see that Looker Studio has correctly set it to 'Date'. So no need to worry about that.
PARSE_DATE("%Y%m%d",MIN(Date))
Whichever of the two methods given above that you followed, you can use your new Published Date field in your chart:
There's one final step, and that's to make sure that the date range of the chart covers the entire life of your YouTube channel. If it doesn't, then the Published Date won't be as expected.
For example, if you are only looking at the last 28 days, the oldest view in that period will be at most 28 days ago, rather than when the video was first published. So:
Personally, I prefer to use the dropdown in the top-right of the date picker and go to Advanced. I then set the Start Date to Today Minus 10,000 Days and the End Date to Today Minus 1 Days.
This covers the entire life of my channel and means I won't have to update the date range at all in future (unless I am using Looker Studio for another 25 years):
Once you've configured your chart dimensions and metrics, and chosen your date range, the chart in your report will look something like this:
As you can see, the chart lists each video in your channel, along with its total number of views and its published date (AKA the date that it received its first view). Success!
(And yes, the Technically Product YouTube channel only has three videos at the moment... let's just say I'm working on it.)
Thank you, this was very helpful! What about if we wanted to do how many days the video has been live?
Thank you Rosalyn! You could create a new field for that, using the DATETIME_DIFF() function. Something like this works for me:
This tells me the number of days between TODAY and my Published Date field.
Thank you SO much for getting back to me!! Really appreciate your help.
I am still stuck and not sure where my issue is.
When I copy your formula above "Published Date" doesn't appear and when I do the PARSE_DATE which you explained above it pulls a random number that isn't correct. This is the formula: DATETIME_DIFF(TODAY(), PARSE_DATE("%Y%m%d",MIN(Date)), DAY)
Thanks again for your help!
Ah, OK! First you'll need to create the 'Published Date' field following the instructions in my article.
Then you can use that field as part of a second custom field using the formula in my comment.
If you're still stuck, feel free to drop me an email at james@technicallyproduct.co.uk
Good luck!