Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

How to query for latest versions (automatically)?


I would like to query a custom attribute grouped by mobile app version and create a Dashboard. However I’d like to only see the latest app versions, older versions have no interest and distort the values since their user base decreases with time.

I have something like this:

SELECT percentile(timeElapsed, 50) FROM MobileCustomEvent FACET appVersion WHERE appName = 'iOS' AND name = 'dataReady' TIMESERIES

I know I could set a base version like:

SELECT percentile(timeElapsed, 50) FROM MobileCustomEvent FACET appVersion WHERE appName = 'iOS' AND name = 'dataReady' AND appVersion > '2.1.0' TIMESERIES

but I’d like a chart I don’t have to manually update (‘2.1.0’ is fine today, but not in a couple of months).

Is it possible to somehow just take into consideration the latest N versions?

(limit does not seem to help here, since results cannot be ordered afaik)


See if you have and can use appVersionId to filter out lower versions. I’m skeptical you can do > ‘2.1.0’.


Actually you can. That’s what I am doing at the moment. But I’d like a dynamic query and not having to increment the version manually from time to time.


NRQL params is something we have requested as an enhancement. That kind of thing could help you. LIke using a filter on the dashboard we’d like to be able to set values of params that can be used in NRQL for use in math and comparisons etc.

What kind of logic would you use to determine your dynamic threshold appversion?

You can use the api’s to update dashboards. In this way you can script your version updates to the NRQL using whatever external logic you can cook up.


@xavi.gil - Hey there! It looks like @6mm was able to get you the right information. Right now there is no way to have dynamic queries that auto update to only look at latest versions.

I do like @6mm’s workaround of using the API to update your dashboards/queries. Is that something you could try?


I guess it could be a solution but it is overkill for my case. It is easier to change it manually than having to use the API.

I was looking for an easiest approach, something like an ORDER BY plus a LIMIT clause or similar.

Anyway, thanks for your help.


Understood! Yeah a ORDER BY statement is not currently supported in Insights. I’ll get a feature request filed internally for you for more flexible query capabilities. let us know if we can help with anything else for now.

Feature Idea: Dynamic NRQL Queries

I’d like to second this request. We’re running into this issue right now.


Hey @schleretht - Thanks! I’ll get that +1 added here.


@schleretht - I have created a new post in the Feature Ideas Category - it would be awesome if you could go to vote there & add your voice to that feature idea: