Is there a way to add the current timestamp to a Google Data Studio report?

孤街醉人 提交于 2020-12-12 10:03:45

问题


I created a simple report to track the funds raised for our primary school. Just a pie chart that picks data from a Google Sheets being maintained by the treasurer. There is now a request to add a timestamp on the screen (the report is being shared by taking a screenshot and sharing in various social media platforms to report progress).

After some Googling I couldn't find a function that returns current time. Something like =now() in Sheets. However, it was recommended to try create the time in the source data. So I created a field that stores the value of the current time in Google Sheets using this function:

=(now()-date(1970,1,1))*86400

I also set the Sheets to refresh every minute. The Sheets works perfectly.

On the Studio side I added a calculated field to display the time in my preferred format:

TODATE(Amount,'SECONDS','%H:%M:%S on %d %b %Y')

Again, this conversion works perfectly.

The problem is that the time refresh doesn't work on the report side. No matter how many times I refresh the data it still doesn't pick the updated time from the source. Yet the source sheet has the updated time.

As far as I can tell, the worksheet time update has to be triggered manually for the report to be updated.

That negates the whole purpose of the timestamp.

Sharing the report directly from Google Studio is not a practical option for now. Still, I have shared the report.


回答1:


There isn't a function to do that yet but hopefully will come soon (see:https://issuetracker.google.com/issues/78200216 which is assigned) however with a little careful design, you could achieve it using date rather than timestamp utilising a date filter.

If you don't have a date field in your data than you could simply set this to TODAY.

If you do have a date field then use the advanced date to set a start date of your field's earliest date and max date of TODAY.

You could then use some shapes / formatting to cover up what isn't needed.

Hardly ideal but maybe a stop gap?




回答2:


0) Summary

Use either:

  • #1 New Recommended Approach: Using Scorecards
  • #2 Original Suggestion: Using Tables

1) New Recommended Approach: Scorecards

It can be achieved using the CURRENT_DATETIME function (released on the 17 Sep 2020 Google Data Studio update to Dates and Times).

The below looks at three use cases using Scorecards which are aggregated by MAX or MIN (in the below scenario either aggregation would display the same Date Time); the fields will automatically update based on the chosen Data Freshness settings (for example, the Google Sheet used in this Report is set to refresh every 15 minutes) and can also be manually updated if required (by clicking on the refresh icon at the top of the report or using the shortcut keys Ctrl + Shift + E):

1.1) UTC

The default function would display a value based on UTC:

CURRENT_DATETIME()

1.2) Time Zone

A Time Zone could also be specified; for example, the below would display the the EST Time Zone:

CURRENT_DATETIME("EST")

1.3) Location

A location can also be specified, based on the TZ database name, for example, Colombo, Sri Lanka would be:

CURRENT_DATETIME("Asia/Colombo")

Added an Editable Google Data Studio Report and a GIF to elaborate:

2) Original Suggestion: Tables

The below looks at three use cases (outlined above) created using Tables.
Added an Editable Google Data Studio Report and a GIF to demonstrate:




回答3:


There is a variable TODAY() that doesn't seem to be documented in their Function documentation but that works in calculated fields and may help you



来源:https://stackoverflow.com/questions/58211728/is-there-a-way-to-add-the-current-timestamp-to-a-google-data-studio-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!