Hi Team :slightly_smiling_face: I am struggling wi...
# gooddata-cloud
r
Hi Team πŸ™‚ I am struggling with this metric SELECT MAX({label/happened_at.day}) What I am expecting to see is the latest "happened at" date. However in reports this shows as "2,022". I think it's being treated as a number or internal representation, not a date. I am not sure if there is an issue with the metric format or the date itself. Any suggestions appreciated πŸ™
m
Hi Raffaella, this is expected, as
MAX(Date)
alone will return the numeric value, and not the actual readable date. Do you want to display the value (fact or metric) associated with the most recent date (maximum date) on in a report? To achieve this, you can use a MAQL metric that identifies the maximum date and retrieves the corresponding value. Please note the example, as mentioned in the documentation below:
Copy code
SELECT SUM({fact/snapshot_value}) 
WHERE {attribute/snapshot_date.day} =
      (SELECT MAX({attribute/snapshot_date.day},{dataset/fact_dataset}))
More details can be found here: https://www.gooddata.com/docs/cloud/create-metrics/maql/aggregation/max/#examples
r
Hi Michael, I need this to show as the most recent date, in format mm-dd-yyyy. The dates appear as labels when I try to add them to a metric. Not dates or facts.
m
My apologies for the delay in getting back to you - Would you please be so kind as to send us over a direct link to the report you have created so we can review this for you? Also, if you could please tell what you expect to see there, versus what you’re currently seeing, that would be great and we will review for you and get back to you asap with more details.
r
Hi Michael. I will share the direct link via DM shortly.
j
Hi Raffaella, Michael is actually out on PTO now. Could you please DM me the link?
βœ… 1
Hi Raffaella, I was looking into the metric and see that no custom formatting has been set. Could you please change the format of the metric to: #####, and see if this helps your use case?
r
Hey Joseph, sorry but this doesn't work unfortunately (it shows 2022, while I am expecting e.g. 20/06/2022). Please note that when I am adding the date as full date, this appears as {label/happened_at.day} in the metric. Also when selecting it, this appears as an attribute, not a date, but in the LDM, this shows correctly as date*.* Is there anything wrong with the date itself?
j
Hi Raffaella, I'm sorry I originally thought it was just formatting to show the year. I am afraid that currently the date formatting is not available. You can use metrics like MAX(date) to filter other metrics by date, but at this point they are not meant to be displayed as a formatted date. Our product team is working on this currently, so I can mark this as product feedback so they are aware more customers are interested in this feature.
πŸ‘€ 1
p
πŸŽ‰ New note created.
πŸ™Œ 1