How to display metric comparison between certain date and previous time period? - google-data-studio

I have a data source consisting of date, URL, and metric (number) which changes for each URL from date to date.
So I built a report with this setup:
date as Date Range Dimension,
URL as Dimension,
metric (average) as Metric,
default date range as today,
comparison between date and previous time period.
With this setup, I got the metric for today for each URL and the comparison between today and yesterday. This works like a charm.
Then I wanted to see the average metric for today in comparison to yesterday and changed the setup to this:
date as Date Range Dimension,
date as Dimension,
metric (average) as Metric (to see the average metric for today and comparison of it with yesterday)
Now I see the average metric's value for today, as it should - but no comparison value.
What am I doing wrong? How do I display the comparison of metric between then date and the previous time period?
EDIT 1: Here is report link with editing rights. And here is the data source - Google Sheets document.
On the screenshot you see:
in the top table every URL with its today's metric and comparison to yesterday,
in the bottom table you see the date with the average metric for today - but no comparison value.
Edit 2: I added to the data source (Google Sheets) an additional column where the date is 100% correctly recognized by Google Sheets as date (not as DateTime, as in original column). But no success here too.

Related

How can I apply 2 date controls on report/page level?

I want to know if it is possible to have 2 date range controls on my page. Each date range control would be connected to a different date (Purchase date / Consumption date) of our products).
Here is a simplified editable copy of the data studio report.
The Google Sheet source looks like:
ID
Purchase date
Consumption date
Product
Price
ABCD12
21/03/2022
09/11/2022
A
£50
EFGH34
22/03/2022
22/11/2022
B
£80
IJKL56
23/04/2022
15/11/2022
A
£50
MNOP78
24/03/2022
06/12/2022
A
£50
The output I'm looking for is to be able to filter data so that I can answer the question "how many products were purchased in March 2022 that have a consumption date in November 2022". The expected output is as follows:
ID
Purchase date
Consumption date
Product
Price
ABCD12
21/03/2022
09/11/2022
A
£50
EFGH34
22/03/2022
22/11/2022
B
£80
Supermetrics has a Date Picker that essentially does what I need it to do. But it has 2 downsides 1) it is bulky and does not work well with many years of data and 2) It does not allow breaking down to more than a monthly level.
Is there another way to make this happen with parameters?
Through this post I've gotten as far as getting a 'switch' for my graphs and tables between the two date datapoints, but that is not the solution I'm looking for.
actually you did find already a good solution by the 3rd party Add-one "Date Picker" from Supermetrics. An alternative route is to include two tables which only have the consumption date as a column. The user can then select these and do a cross filtering of the main table.
In the first table, the dimension has to be changed to "Year Month":
An alternative community visualisation to the Date Picker (based on the limitations cited in the question) would be the Range Slider.
Two Range Sliders could be used (one for each date field), however, the below will use one Date range control and one Range Slider to demonstrate that they can work together (as well as maintaining the original setup in the question):
1) Purchase date
1.1) Date range control
1.2) Table
Date Range Dimension: Purchase date
Dimension 1: ID
Dimension 2: Purchase date
Dimension 3: Consumption date
Dimension 4: Product
Metric: Price
2) Consumption date
2.1) Range Slider
Column to filter on: Consumption date
(Chart Interactions) Cross Filtering: ☑
Publicly editable Google Data Studio report (embedded Google Sheets data source) and a GIF to elaborate:

Can time series settings in Google Data Studio change depending on date format?

I have a table with column "date" in YYYY-MM-DD format HH:MM:SS:MMM (2015-01-27 11:22:03:742). I'm trying to make a time series with the dimension of month/year grouping, to display the total number of records by period.
Settings:
period dimension: date (type: date and time)
period: date (type: year and month)
metric: record count
My time graph doesn't display anything. Can someone help me identify what's going on?
formatDate is the column created with the expression:
PARSE_DATETIME("%Y-%m-%d %H:%M:%S",REGEXP_EXTRACT( create_date,"(.*):[0-9]*"))
Using the date in its standard format, as mentioned at the beginning of the question, the same happens.
When entering dates (original and formatted), both appear with null values.
The milliseconds have to be separated by a . not a :. An option is to import your date a as string/text and add a calculated field, which parse the string in Data Studio:
PARSE_DATETIME("%Y-%m-%d %H:%M:%S",REGEXP_EXTRACT( data_field,"(.*):[0-9]*"))
If the dates are several years in the past, please adjust the Default date range in your graph:
I leave the solution to my problem to the community.
The problem is in the date format. Failed to get Google Data Studio to receive a date with milliseconds. By removing the milliseconds it was possible to work with the dates normally, managing to apply the available functions.
Note: It may be a knowledge limitation, but none of the date formatting functions work if the datetime field contains milliseconds (FORMAT_DATETIME, PARSE_DATETIME,...)

Data Studio - Grouping by Week

I have a simple Data Studio table consisting of two columns. The first column is the week (ISO Year Week) and the second column is the total registrations we've received for that week.
However, my Week column repeats 7 times (7 Rows) for each week as it's counting by day within that week. See below:
Is there any way to get this to group by the listed week? Below are my settings:
Dimension = Conversion Date set as "ISO Year Week" for the type.
Metric = Equals the count of Conversion Date (Same Conversion Date field used for dimension)
Any help would be much appreciated.
There might be an issue with the date format of the source. Without knowing the source (e.g. Google Analytics or Sheets) it’s hard to tell.
Blended Data
I recently had this issue with blended data. The response of a similar question helped me to find a way.
Basically you have to add a new custom field to the data source with the formula WEEK(date_field_link). Data studio will recognise this as a date in compatibility mode, but for me it still works. Then you can use this new date field as a join key to blend the data while grouping it in weeks.
Normal Data
If this problem appears in a regular non-blended dataset you might want to check if Data Studio correctly catches the date as a date. This help article from Google might be worth checking out: https://support.google.com/datastudio/answer/6401549?hl=en#zippy=%2Cin-this-article
I made a similar case work using blended data.
Your column "Conversion Date" repeats the same week 7 times because it's just a display value. Every row has a date value (year, month and a day) but you're just showing the corresponding week. So, data-studio treats them as different data and doesn't group them.
To be able to group them by Week you need to create a new field with a value containing only the week and the year. So, you can use the formula
YEARWEEK(your_date)
The resulting Date will be groupable.
NB1: If your date isn't of the type Date, you can parse it from text to date using
the method:
PARSE_DATE("%Y-%m-%d", your_date_text)
NB2: If the created field has the type number and doesn't show the possibility to change type to Date, you can do this trick: (it's weird but it works):
First type as a formula for the created field and apply:
MONTH(your_date)
This will unlock the compatibility Date types. You can choose from them the ISO Year Week type.
and then change the formula from MONTH(your_date) to YEARWEEK(your_date) [your formula] as I explained above. The chosen date type won't go away even if it wasn't available the first time.

Google Data Studio date aggregation - average number of daily users over time

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.
Try to create a new metric that counts the dates eg
Count of Date = COUNT(Date) or
Count of Date = COUNT_DISTINCT(Date) in case you have duplicated dates
Then create another metric for average users
Users AVG = (Users / Count of Date)
The average depends on the timeframe you have selected. If you are selecting the last 28 days the average is for those 28 days (dates), if you filter 20 days the average is for those 20 days etc.
Hope that helps.
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:
Report Name: create one report per day, in this case 7 reports. Name them (for example) Users-1 through Users-7. These are your Row 2 values. You'll have 7 columns, with the first report name in column B.
Start Date and End Date: use TODAY()-X where X 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. Report Users-1 will use TODAY()-1 for start and end, etc.
Metrics: enter the metrics e.g. ga:users and ga:new users
Create the reports
Use 'Run reports' to have the result sheets created and populated.
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 and New 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.

Keep PivotTable report filter after data refresh

I have a PivotTable (actually it is five PivotTables, each on its own separate sheet) that is created from a query of an outside database. Each of the PivotTables represents a day (i.e. Today, Tomorrow, Today+2, Today+3, and Today+4). For the report filter for the first two, we use a date range filter of today and tomorrow which automatically filters the data and allows it to roll over. We created custom date ranges for the other three days, but upon every external data refresh we have to go into each sheet and reselect the report filter from all to the specified time frame. This data rolls over every day so we can see the lineup for the next 96 hours out.
Is there a way to either keep the PivotTable report filter criteria (VBA and macros are both acceptable, although we are also fairly new to both)?
Or is there some super secret way to extend the report filter from just today and tomorrow to a time range (48 hours, 96 hours) instead of next month?
I need the days to be separated, so next week will not work because all the days will populate on one page.
Without seeing a real example it's hard to tell, but how about changing the query to a relative date index, i.e. something like
SELECT DATEDIFF('day', GETDATE(), report_dt) AS days_from_today FROM reporting_table
And then set your report filters on this relative date index (days_from_today = 1 for tomorrow, etc)? You can always create another Excel column in the report =TODAY() + days_from_today to get your absolute date back. (Assuming you are just dealing with one time zone for reporting purposes.)
I.e., instead of rolling filters, keep the filters on constant indices, and let the indices cover a rolling date range. I'm not sure Excel is smart enough to do the rolling filters thing.

Resources