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

Can I use NRQL to get counts of distinct values of a custom metric?



Imagine I collect a custom metric, using the Python client:

        'register_failed', True) # I gave True as an example but any value gets ignored

Now I want to get all distinct values given as a second parameter, how do I do that?

When I do:

SELECT register_failed FROM Transaction WHERE appName = 'some_app'

I’m getting empty values:

What am I doing wrong and how to correct the query?


Does your custom event data appear in the ‘Transaction’ data table or as a distinct custom event?

Be worth checking in your Insights Explorer first to confirm the event detail is within the transaction for that app.


Assuming it is, you have to check the case and syntax of the custom event (in insights explorer (hover over)).

For example. I have a custom event called Custom.1 Oybsnapr but I need to query:
SELECT `custom.1OYBSNAPR` FROM SyntheticCheck where monitorName = ‘MonitorX’

So to answer the question, yes…


Hi @michal.nowotka

I’d suggest modifying the query to see if you are ever getting the ‘true’. Since you are sending this as a boolean you’ll want to use IS NOT NULL

SELECT register_failed FROM Transaction WHERE register_failed IS NOT NULL SINCE 1 hour ago


Though you see as no value for custom attribute, if run
SELECT * FROM Transaction WHERE appName = ‘some_app’ you will see the values for your custom attribute.