I'm creating a dashboard of marketing leads from a Data Source that has two columns of dates in it. One of the columns is historic dates that were imported. One of the columns is all new leads, with accurate dates.
I'm trying to create a new field in Data Studio for use as the Date Range Dimensions. Essentially, if historic date is null, then use new date. If it isn't null, use the historic date.
This is my current code:
CASE
WHEN Historic Date IS NULL THEN Created Date
ELSE Created Date
END
There are no errors thrown when creating the field, but when I set it as the Date Range Dimension, I get this error:
This data source was improperly configured.
Invalid argument type.
Seems that Case function has as output a string which cannot be recognized or configured as a date in google Studio. It can be a bug from Data Studio, but the fact is that I have the same problem and I solve it converting the output of case into a date format.
I have no much time to explain/expose it better, therefore I will put the function that worked for me:
todate(CASE
WHEN Status IN ("X","NMX","MX") THEN Cancel Dt cf
ELSE Confirm Dt cf
END
,'%Y%m%d','%Y%m%d')
Hope it fixes you well you or at least gives you some light/direction on how to solve it.
Related
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
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.
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.
Using Crystal Reports version 8. Trying to restrict data retrieved based on date range provided by the user.
Here is the formula I am trying to use in the Select Expert:
{Query.current0} <> 0.00 and
{Query.status} in ["PIF", "SIF"] and
{Query.closed} >= DateTime ({?Start}, Time (00,00,00)) and
{Query.closed} <= DateTime ({?End}, Time (23,59,59))
When I click the error checking button, CR gives the error "A date-time is required here" and puts the cursor at the end of the second line after the "and".
I have confirmed both {?Start} and {?End} are Date parameters and they do have data in them. {Query.closed} is a datetime in the original database, and if I remove the {Query.closed} date restrictions, the report runs fine (it just pulls all the data in the database!).
Oddly enough, I have another Crystal Report that runs just fine using this formula in the Select Expert:
{Collect2000Log.LogWhen} >= DateTime ({?FromDate}, Time (00,00,00)) and
{Collect2000Log.LogWhen} <= DateTime ({?ToDate}, Time (23,59,59))
In both reports, the parameters involved are Date parameters, and both {Collect2000Log.LogWhen} and {Query.closed} are datetime fields. One major difference is the PIF/SIF report (the one with the errors) is built on a saved Crystal SQL Query and the one without errors was not.
Can anyone help me spot what I am missing?
After further exploration, I'm not sure what the actual issue was, however I re-created the report WITHOUT the use of Crystal SQL Queries and it is now pulling data just fine. Would appreciate knowing the details if anyone can explain, but for now mystery is solved!
I am working with SQL Server Report Builder 2008 R2.
I have a dataset that contains DateEntry (date, null) and TimeStampAuto (time(7), null) columns. I am trying to write an expression for concatenating those two values, so I can put it under DATETIME column on the report table. I tried the following but it does not work. It displays "#Error."
=First(Fields!DateEntry.Value, "Report1) & " " & First(Fields!TimeStampAuto.Value, "Report1)
When I just put the first part of the expression shown above, the report displays the date with some random time value (5/1/2015 12:00:00 AM). However, I did not put any time value in DateEntry. I only put the dates.
When I put the second part of the expression shown above, the report displays correct time that the data has.
I don't know why I can not concatenate those two.
The system type of the DateEntry.Value will be a DateTime value which is the readon that your report is showing 5/1/2015 12:00 AM even though it is only a date field in the database.
You need to format the date to only include the day,month and year to remove the included default time of 12:00 am
you will probably need to check for null values in both your date and time fields. you will also need to format the time filed to exclude any default date information.