Datastudio: Blended Data: Datetime can't be aggregated - google-data-studio

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.
However, when I blend the case table with the party table, the aggregation doesn't apply on the date field anymore.
This is how I join the tables.
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
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
Create b.csv in local.
a_id,b_id
1,1
1,2
2,3
3,4
4,5
4,6
Upload a.csv and b.csv into a Data Studio report.
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.
Add a "Table" type chart using the blend created in the previous step.
Put date field as the only one dimension and select "Year Month" as the type.
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

This is a bug, and it was already reported in Google's DataStudio IssueTracker.
https://issuetracker.google.com/issues/179280180
You probably want to star the issue (Google prioritize issues by the number of affected users).
Also, in the same thread, the reporting user suggests to use the above formula as a workaround.
YearMonthAsDate = DATE(YEAR(date_tran),MONTH(date_tran),1)
It worth a try.

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

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:

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.

Create a column within an SSRS Report to sum values based on conditions of previous column

I have an ssrs report that shows revenues for each month of a year for several years based on start and end date parameters the user enters. What I would like to do is add a second column that shows the revenue for that quarter (march would show q1 revenue, june q2 etc). the problem I am having is that I am able to do this for a single year but once the query starts looking at multiple years my column shows the value for all 1st quarters regardless of year. The picture shows what I am currently getting. Any recommendations on how to fix my expression to also look at the year value when summing these quarters?
Here is the code I am using to only populate the quarter column based on the month.
=IIF(Fields!Sort_Order.Value=3,
Sum(Lookup(1,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(2,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(3,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=6,
Sum(Lookup(4,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(5,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(6,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=9,
Sum(Lookup(7,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(8,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(9,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=12,
Sum(Lookup(10,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(11,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(12,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),""))))
I ended up creating a quarter column within my data set that was then used as a parent group for the month rows. I then hid that column and added a total for the quarter that gave me sub totals. Not exactly what I was looking for but gave me the result I needed.

[stimulsoft]: one master with three separate details

I'm new in stimulsoft.I'm trying to build a report with three tables which I know I should use master details but I can't find a way.
well, I have three tables.
1.Info(Date,name,type,x,y)
2.cost(Date,Item,amount)
3.Bill(Date,BillNo,PaymentNo,Cost)
column Date is the key.
I want to group the information of these tables by date
and under each group I want to show the information of each table in Separate databands.in this way:
5 Sep 2016
name1,type1,x1,y1
name2,type2,x2,y2
Item1,amount1
Item2,amount2
Item3,amount3
BillNo1,PaymentNo1,Cost1
4 Sep 2016
name3,type3,x3,y3
Item4,amount4
Item5,amount5
BillNo2,PaymentNo2,Cost2
BillNo3,PaymentNo3,Cost3
there are multiple rows with equal date in tables.
I try many ways but it shows all cost and bill information per rows of info!!
Is there any way? Thanks.
Use Group Header (or Group Footer) within a DataBand.
Remember set the condition for your Group Header to your column Date like this:
{YourDataSource.Date}
By this, the Date field apear only once in the group.

SSRS report with stored procedure Dataset and aggregation by month - how to handle "empty" months?

I have a SSRS report which calls a stored procedure to return a two columns dataset - one column is a Date and the other is a calculated column I created to show the month in the format MMM-YYYY.
Using this dataset I have created an aggregated bar chart report which shows the number of records per month for each month value which has at least one record in the dataset, however I would like to be able to include on the chart any months within the range of the dataset even if they do not contain any records.
So for example, where at the moment I see the following data points on my chart:
Month Count
----- -----
Oct-2015 2
Nov-2015 5
Jan-2016 3
Feb-2016 6
Dec-2015 is missing because my Dataset didn't return any records for it, so I would like to be able to plot a zero Count value on the chart for this month.
Now I know how I would normally do this in SQL, with some kind of calendar table LEFT JOINed in so that I can return the months with zero counts, but can I achieve the same in SSRS with a stored procedure as the target of the main dataset?
If your grouping is on a date/time (or a number), you can make the axis type for it Scalar.
Create your chart, with Count as the value and Month as the Category Group
Right-click the grouped axis (horizontal in my example below) and go to the Axis Properties
Change the Axis type to Scalar, and change the Interval type to Months
Still in the axis properties, change the Number Category to Date, and the Type to Jan 2000 (or use a custom format)
My first instinct was to aggregate by an actual date, converted to the first of the month, instead of your MMM-yyyy string. However, it appears that SSRS (2008 R2 in my case) recognises text in the format MMM-yyyy as a valid date, so your existing procedure shouldn't need changing.

Resources