Datastudio: Blended Data: Datetime can't be aggregated

Viewed 467

I have two tables case and party. Both of them are from BigQuery. In the case table, there is a date field in the DATETIME type in BigQuery. I want to plot a chart to show the number of cases per month. It works perfectly when I only use the case table.

case number per month date shows in Year Month type

However, when I blend the case table with the party table, the aggregation doesn't apply on the date field anymore.

multiple rows with the same year month doesn't aggregate into one row

This is how I join the tables.

join by case id apply inner join

How do make the aggregation of date & time fields in blends work as normal?

Update

I have tried to create a custom field with TODATE(date, 'RFC_3339', '%Y-%m-%d'), but the aggregation is still not applied to the custom field.

minimal example

  1. Create a.csv in local.
a_id,date
1,2022-05-25T00:00:00
2,2022-05-25T00:00:00
3,2022-06-01T00:00:00
4,2022-06-02T00:00:00
  1. Create b.csv in local.
a_id,b_id
1,1
1,2
2,3
3,4
4,5
4,6
  1. Upload a.csv and b.csv into a Data Studio report.
  2. Blend a.csv and b.csv with inner joining on a_id field. I removed "Record Count" from metrics in both tables and added all fields as dimensions.
  3. Add a "Table" type chart using the blend created in the previous step.
  4. Put date field as the only one dimension and select "Year Month" as the type.
  5. Put a_id field as the only one metrics and select "Count Distinct" as aggregation.

actual result

date (Year Month) a_id
May 2022 2
Jun 2022 1
Jun 2022 1

expected result

date (Year Month) a_id
May 2022 2
Jun 2022 2

example report

Here

2 Answers

You are changing the Date dimension in the table but in order to aggregate it on a monthly basis but joins the rows on a date base.

The solution is to change the Dimension to Month year inside the blend settings, you can do this just the same way you change a field type inside a table.

Related