This should be simple so I think I am missing it. I have a simple line chart that shows Users per day over 28 days (X axis is date, Y axis is number of users). I am using hard-coded 28 days here just to get it to work.
I want to add a scorecard for average daily users over the 28 day time frame. I tried to use a calculated field AVG(Users)
but this shows an error for re-aggregating an aggregated value. Then I tried Users/28
, but the result oddly is the value of Users for today. The division seems to be completely ignored.
What is the best way to show average number of daily users over a time frame? Average daily users over 10 days, 20 day, etc.
I have been able to do this in an extremely crude and ugly manner using Google Sheets as a means to do the calculation and serve as a data source for Data studio.
This may be useful for other people trying to do the same thing. This assumes you know how to work with GA data in Sheets and are starting with a Report Configuration. There must be a better way.
Example for Average Number of Daily Users over the last 7 days:
Edit the Report Configuration fields:
Users-1
throughUsers-7
. These are your Row 2 values. You'll have 7 columns, with the first report name in column B.TODAY()-X
whereX
is the number of days previous to define the start and end dates for each report. Each report will contain the user count for one day. ReportUsers-1
will useTODAY()-1
for start and end, etc.ga:users
andga:new users
Create the reports
Create a sheet for an interim data set you will use as the basis for the average calculation. The first column is date, the remaining columns are for the metrics, in this case
Users
andNew Users
.Populate the interim data set with the dates and values. You will reference the Report Configuration to get the dates, and you will pull the metrics from each of the individual reports. At this stage you have a sheet with date in first columns and values in subsequent columns with a row for each day's values. Be sure to use a header.
Finally, create a sheet that averages the values in the interim data set. This sheet will have a column for each metric, with one value per column. The one value is calculated from the series in the interim data set, for example
=AVG(interim_sheet_reference:range)
or any other calculation you'd like to do.At last, you can use Data Studio to connect to this data source and use the values. For counts of users such as this example, you would use
Sum
as the aggregation field type when you are creating the data source.It's super ugly but it works.