Good morning team - I am looking to build the inst...
# gooddata-cloud
j
Good morning team - I am looking to build the installation & removal dates of products, as metrics. However, this doesnt seem possible using min() & max() functions. Do you have advice on how I can create this? Thanks.
m
Hi James, could you please provide a concrete example of what you need? Can it be coded in SQL, for example?
j
Hi Moises, Below, we have an EGM (electronic gaming machine) column. I am looking to create metrics that will enable me to capture the installation date i.e. the first date that this game was deployed. However, I have been unable to use min(date). Yes, this could be coded in SQL, but we are looking to primarily complete our data modelling in GoodData
m
Thanks. This can certainly be achieved with min: https://www.gooddata.com/docs/cloud/create-metrics/maql/aggregation/min/ For example:
Copy code
SELECT SUM({fact/snapshot_value}) 
WHERE {attribute/snapshot_date.day} =
      (SELECT MIN({attribute/snapshot_date.day},{dataset/fact_dataset}))
Could you share how you have tried to define your metric?
j
I am looking to return the minimum date for an attribute column. Here is an example of what I have tried: SELECT {label/EGM} WHERE {label/date.BUS_DATE.day} = (SELECT MIN({label/date.BUS_DATE.day})) I have also tried to include the dataset where the BUS_DATE comes from as a parameter, but I can't get either to work: SELECT {label/EGM} WHERE {label/date.BUS_DATE.day} = (SELECT MIN({label/date.BUS_DATE.day},{dataset/DIM_DATE}))