YYYYMM, when converted into MM & YYYY, is refecting the previous month. For example - 202001(which is Jan 2020) is giving 12 & 2019 (that is, Dec 2019). What is going on ??!!
My data source is BigQuery where I have joined two google sheets on YYYYMM as the primary key - I created this by extracting year and month from dates of the two google sheet and concatenating them.
I would suggest using complete YYYYMMDD Dates in Google Data Studio, as I haven't faced any issues with inaccuracy, using the YYYYMMDD format.
One way it could be achieved is by adding a fixed Day component to the end of the YYYYMM field, such as the 15th; for example, where YYYYMM represents the current Date field:
TODATE(CONCAT(YYYYMM, "15"),"%Y%m%d","%Y%m%d")
Related
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,...)
I've been tracking a bunch of dates (with format string) under the dimension 'Product' in Google Analytics.
In Data Studio, I then have a simple Line Chart with all these dates (x) and their respective List Views. Like this:
Is there a way to aggregate these days by month and year?
Like this:
2020-08
2020-09
2020-10
and so on...
Thanks in advance for your help.
Summary
The below creates a Date field and then uses the Date field in a Time Series chart with Date Granularity.
1) Product_Date
Creating the TODATE Data Source-level Calculated Field below to extract a Google Data Studio recognised Date field (where Product represents the current Date field):
TODATE(Product, "%Y-%m-%d", "%Y%m%d")
GIF to visualise the process:
2) Date Granularity
Chart Type: Time Series
Date Range Dimension: Product_Date
Dimension: Product_Date; set the Granularity as required (Year, Year Month, etc)
Drill-down (Optional): Select and set multiple Date Granularity as well as a default Drill-down.
Google Data Studio Report and a GIF to elaborate to the above:
I need to subtract a day from a date field in Datastudio. My date has the DDMMYYYY format.
It can now be achieved using the DATETIME_SUB function (which was introduced in the 17 Sep 2020 update to Dates and Times):
1) Date - 1
Where the field is represented by Date, the following Calculated Field does the trick (subtracting a Day):
DATETIME_SUB(Date, INTERVAL 1 DAY)
2) Type (Date - 1)
Date
Google Data Studio Report and a GIF to elaborate:
DATETIME_SUB can also become more dynamic adding another field or parameter as its second parameter. BUT you have to CAST it as an int64_expression. Example:
DATETIME_SUB(Date_Field, INTERVAL CAST(Numeric_Field AS INT64) DAY)
I'm working with date and float conversion on sql server and excel.
This is my query:
select getdate(),convert(float, getdate())
I get:
2014-11-21 16:38:49.973 41962,6936339506
If I copy this float number to Excel and I change cell type as date I get this value:
19-nov-2014
What's that? Why there is an offest of two days?
SQL server simply calculates the conversion of a date time to a float as the number of days since midnight on 01-Jan-1900 (i.e. select convert(DATETIME, 0) gives 1900-01-01 00:00:00.000)
Excel calculates a similar number, but the zero date is "00/01/1900". This is probably related to the fact that excel uses one based indexing, rather than the more common zero based indexing. The second day of difference comes from a well known bug whereby excel considers 1900 to have been a leap year.
Takeaway message: if you assume that excel is always behind by two days you'll be ok, except for dates on or before the 28th of February 1900.
I have a challenge saving the date to an MS Access 2007 database especially for dates with the day less than the 12th of a month (i.e. the day between 01 to 11) If for example a February date - 07/02/2013 (dd/MM/yyyy) will be saved as 02/07/2013 in the database. While a similar February date 14/02/2013 will also be saved 14/02/2013. Retrieving the two dates: The first date will brought out as 2nd July and the second date will be 14th February.
Notice that the day and month values is transposed for dates less than the 11th. This happens when I use an update query (either from VB 2005 or directly within MS Access using SQL pane). I have set both the system short date settings (in Windows 7 OS) and the Date Format at field level (in the MS Access Table) to dd/MM/yyyy.
try - DateValue("dd-mm-yyyy")
or - Format(Date,"dd-mm-yyyy") as an expression builder.