DATES visualisations as Headline I got a table wi...
# gd-beginners
g
DATES visualisations as Headline I got a table with datetimes and I'd like to choose the latest datetime as a Headline (example: 2022-08-08 121323) Now, I can't use that as a metric, because I can't use do computation on dates any idea here ? thanks
j
Hi Gorden, just to clarify, would you like to display the latest datetime in a Headline from the table (display the date value)? Or would you like to display for example count or sum etc. of some attribute or fact within the latest datetime from the table in a Headline (display numeric value)?
g
hi the latest datetime as datetime, example "2022-08-08 121223" each observation has one, Min and Max of that Datetime in the header highlighting the last and fisrt entry
j
Unfortunately this is currently not possible
j
Hi @Gorden Pfitzmann, you can possibly use following workaround. You can add timestamp as a fact (number) into data model and use metric formatting capabilities to display it in the format you suggested. Example:
Copy code
select to_number(to_char(cast('2022-08-08 12:12:23' as timestamp),'YYMMDDHH24MISS'),'999999999999')
220808121223
can be formatted using
2\000-00-00 00:00:00
as
2022-08-08 12:12:23
This would let you display minimum or maximum of datetime in the Headline visualisation.
p
🎉 New note created.
g
thanks, I'll try it
s
Hi @Jakub Sterba I'm trying your solution for time stamps above using my logic of select to_number(to_char(cast(xxxx_date_name) as timestamp),'YYYYMMDDHH24MISS'),'999999999999') But I get this error message Unexpected 't'. Expecting: FUNCNAME1, THIS, RUNFUNCNAME, STRING, FUNCNAME2, FUNCNAMEN, REPORT, OBJECT, NATURAL, FUNCNAME12, ELEM_IDENTIFIER, SHORT_STRING, PREVIOUS, (, IFNULL, IF, CASE, REAL, PERCENTILE, TEXT_ELEM, -, IDENTIFIER, RANKFUNCNAME, COUNT, ZERO, NEXT Have you any thoughts on what is causing the issue?
j
Sorry for not being clear. The statement I was proposing was not MAQL but it was SQL statement to prepare data for integration with GoodData platform (part of ETL). If you map a table to dataset in GoodData currently, you can create view with all the columns of the original table + one additional column created by the transformation. E.g.
Copy code
create view dataset_view as select *, to_number(to_char(xxxx_date_name,'YYYYMMDDHH24MISS'),'999999999999') from dataset_table
The dataset would have to map to this view instead of original table. Note that the proposed SQL should work in PostgreSQL database. I am not sure if it works for all the databases. What GoodData product are you using? GoodData.Cloud (domain *.cloud.gooddata.com). GoodData.CN or GoodData Platform (domain *.on.gooddata,com)?
s
Thanks for that I thought it was something that could be applied in MAQL, using platform version so I'll look to implement that table in our DB and import it.