Error: Can't convert text to date (Google Data Studio) - google-data-studio

I have two different date column as Order Date and _paid_date and I am trying to use _paid_date as Date Range Dimension to find out total order paid, total revenue etc. but Data Studio takes it as text and when I tried to convert it to date, I get error like below.
However, when I use Order Date as Date Range Dimension, I get no error and it works.
I created another field with the formula it suggested in the error window and few other formulas that I found online but when I apply, it gets "no data" message in the scoreboard or any other chart that I am using.
How can I fix it so it is working in Date Range Dimension?
My date columns;
The error that I am receiving:

The supported format of datetime is YYYY-[M]M-[D]D [[H]H:[M]M:[S]S].
That's why Order Date work and _paid_date doesn't.
Reference:
https://support.google.com/datastudio/answer/6401549?hl=en#use-dates-and-times-in-calculated-fields&zippy=%2Cin-this-article

Related

Sort by date in Looker Studio (DataStudio)

so I am facing this issue with sorting the data, in the table, by the date. The thing is that I had to change format so that I can see the all together Day of Week, Date, Hour, Minute.
FORMAT_DATETIME("%a %d.%m.%y. %H:%M",MY DATE)
which caused that the sorting is now done alphabetically and the variable is treated as a text and not a date anymore.
enter image description here
Is there any way to include all information and be able to sort by date?
In the Looker Studio documentation (https://support.google.com/looker-studio/answer/9730334?hl=en) we find that FORMAT_DATETIME converts a date to formatted text.
Try to use PARSE_DATETIME (converts text to a date with time)
If you don't have the seconds part simulate them PARSE_DATETIME('%Y-%m-%d %H:%M:%S', CONCAT(DT_ATTRIBUTE, ':00'))

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.

SSRS report - export to excel date time filteration

Populating an SSRS report from dyanmic dataset i.e. number column and order of columns may vary based on condition, and this report on trying to export to excel. But in exporting date column filtration not working. Finds the reason is I bind the column in string format.
Sample data format to understand. Here the columns & order of columns may vary as per condition.
And I am converting this to below format and passing to SSRS as dataset.
And populating report by grouping with ROW_NO & COL
Then I tried to convert DOB column to date time.
For converting DOB to date format changed return type of DOB from sql query as datetime, converted column value to date time using CDate() in SSRS and formatted in own format (dd-mmm-yyyy).
Below expression used for converting to date time:
IIF((Fields!COL.Value="DOB") ,CDate(Fields!VALUE.Value),(Fields!VALUE.Value))
But showing #Error for columns data type other than date time:
Go to your detail textbox in the DOB column. And use the following expression:
=Format(CDate(Fields!DOBValue.Value), "dd-MM-yyyy")
This way the date in your DOB column will show 23-01-2018
Note: The expression just works if in the Fields!DOBValue.Value field are just dates. If there is a N/A it will throw an error. Then you have to clear the N/A first.
And if you want to export it to Excel you need to set the language in your report properties (use your region) and go to your textbox where you wrote in the above expression under Textbox properties > Number chose Date format.
UPDATE
Based on your updated question I think I found the error. The problem is your writing of the month names combined with the report language. My report language is set to DE. For me the following works:
=CDate("15-Mai-94") 'Result 05.05.1994
But this dosent work:
=CDate("15-May-94") 'Result =Error
The second one works, when I set the report language to EN but then the first one throws an error

Creating composite dates from individual year, month, and day in Google Data Studio

I need to create a YYYYMM format computed column for defining a date in Data Studio since our data is held in separate year, month, and day columns. Unfortunately our the month and day fields are not left zero-padded so a simple concat will not work.
The formula I'm using still uses concat, but also uses todate to parse the hyphenated date string into the compatible format.
TODATE(CONCAT(systems.added_year, CONCAT('-', concat(systems.added_month, concat('-', systems.added_day)))), 'DEFAULT_DASH', '%Y%m')
The problem I'm running into, is that Data Studio doesn't seem to correctly recognize the resultant value, even though it seems to be correct. I'm not sure why, but the YYYYMM field seems to one-month behind even though the result of the calculated field looks correct.
In fact it seems 1-day behind, if I show YYYYMMDD the displayed value is the last day of the previous month.
Here is a screenshot showing the component elements, a string version of the calculated field, and then a Date(YYYYMM) version of the calculated field.
Looks like a bug with the output format. As a workaround, you could output as a full date and then change the column format to YYYYMM.
TODATE(CONCAT(year, CONCAT('-', CONCAT(month, CONCAT('-', day)))), 'DEFAULT_DASH', '%Y-%m-%d')
You could also use '-01' as the last segment.

Resources