Google Studio - How to change the display of dates in line chart? - google-data-studio

I am using Google Data Studio and have a date field that comes in as "2022-05-23".
But in the charts themselves they always get displayed as May 23, 2022.
How does one tell google to stick to something like "2022-05-23" or does google insist on spelling out the Month to avoid any confusion?

You can create a calculated field that format the date column as string, using the function FORMAT_DATETIME:
FORMAT_DATETIME("%Y-%m-%d", my_date_column)

Related

How can I convert numbers to hh:mm:ss in Google Data Studio?

I am trying to convert numbers into duration in Google Data Studio, however it's not showing the correct output.
I want column A numbers in the form on Column B as an output, but in Google Data Studio it's showing the duration as 0:00:00.
You must create a custom field and use this as the formula:
Number*86400
then choose the type to be "Duration(sec.)"

Google Datastudio: Categorize new and returning user id based on their first appearance date

I want to categorise users to the new and returning users based on their first appearance date in Data Studio, so if I select the date range of June 1, 2019, to June 30, 2019, every user with first appearance date is on that period is categorised as a new and every users before that period categorised as the returning users.
The data looks like this:
user_id
Firstcontact
9020784665
21/05/19
80302116604
21/05/19
34032004987
02/06/19
85963021828
03/06/19
42703694037
04/06/19
7985228940
05/06/19
39174203617
06/06/19
62014629759
06/06/19
71599733666
06/06/19
3617458365
06/06/19
I was considering to use the CASE function but nothing seemed to work.
I expect the output of new users based on selected date in Data Studio
This is something you'll need to create a segment for in Google Analytics to use in Data Studio

How to create new date field using CASE in Google Data Studio

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.

How to customize kibana field datetime format to MMM YY format in table visualization

I am trying to create a simple table kibana visualization that summarizes data into monthly buckets for with row counts. Unfortunately, I am not able to figure out how to customize this summary so the time perspective is represented as "MMM YY" format rather than the original timestamp format of the index.
Kibana displays timestamp, but would like month
Any advice would be appreciated.
you need to navigate to the kibana screen with list of all fields in your index (I think it's management)
Then look for the date field and press on the edit button, in the new screen that will open you can define the format.

PL/SQL Date Insert

I am firing a insert query in 'dd/mm/yyyy' format but it is storing date into MM/DD/YYYY format.
I just want to know why it is happening?
This is insert query i am using.
insert into txnblackout(endtime,idtxn,blackoutflag,starttime,startdate,typeuser,id_entity,idsequence,idapp,enddate)
values('83520','LGN','D','7920',TO_DATE('30/12/2012','dd/mm/yyyy'),'ECU','B001','4','A1',TO_DATE('30/12/2012','dd/mm/yyyy'))
If you don't want to change the Windows date format (as suggested by Colin 't Hart), you can
use an explicit to_char() date format in your query (as suggested by Robert Hanson)
set your client NLS settings
configure your client (since you seem to be using PL/SQL developer):
Tools -> Preferences -> NLS options -> Date -> check user defined + enter your format
Personally, I'd set the client NLS settings.
This is a front-end issue: it's displaying the dates in that format. Because they are date fields, the dates really do represent the dates that you inserted.
I note in the bottom right hand corner of your screenshot that the date there is displayed in MM/DD/YYYY order. Change this setting in Windows and it will more than likely display correctly in your front-end tool.
The important bit can be gleamed by your insert, which includes "TO_DATE('30/12/2012','dd/mm/yyyy')". This is converting the string '30/12/2012' to an internal date object format that is specific to the DB. You can't control the underlying storage format. What you can control however is how that internal date object is converted back to a string by using date formatting functions when you call select.
select to_char(some_date, 'dd/mm/yyyy') my_date from some_table;
In the visual interface you referenced it is simply showing the default date to string conversion.

Resources