Is anyone able to provide help with a metric defin...
# gooddata-platform
j
Is anyone able to provide help with a metric definition challenge we’re having? We’re needing to limit the definition to a set period of time (last full month) and everything we seem to try doesn’t work. The last statement we have been testing which doesn’t seem to work is: SELECT ADR where (Select Max(Date) by all other without PF)
m
Hi Josh, I see you are using Max to build your metric, so I assume you want to display the freshest data available (correct me if I’m wrong). In that case, you will have to use this definition:
Copy code
SELECT MAX ((SELECT (10000 * MAX(Year (Date))) + (100 * MAX(Month (Date))) + (MAX(Day of Month (Date))) BY <connection point>)) 
WHERE (SELECT COUNT(Date (Date), <connection point>) BY Year (Date), ALL OTHER) > 0
You can find further information about this in our documentation. You will need to make sure you are using the relevant connection point (attribute) and follow the exact metric syntax as above. Feel free to let us know how you get on.
j
Thank you for pointing me to this! Had a call with Michal this just now and he also pointed me here which seems to be exactly what I’m trying to do! https://help.gooddata.com/doc/growth/en/dashboards-and-insights/maql-analytical-query[…]he-where-clause/referencing-floating-time-periods/this-macro
1