Standard Deviation Query Type

Hello Keen Community! We have released a new query type, standard deviation, to add even more flexibility to your computing capabilities.

What is a standard deviation?

In statistics, standard deviation is a measure used to quantify the amount of variation or dispersion of a set of data values. A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values.


An example of standard deviation in practice

For our customers that charge for their products with usage-based pricing models, standard deviation can provide useful insights into pricing fluctuations to help their users better understand and evaluate their usage and pricing patterns. For example, if a customer’s daily usage costs $50 on average but has a standard deviation of $200, that suggests that their monthly bill may be dominated by a few one-off spikes. This scenario could be flagged for the customer so that they can investigate the cause of the spikes and mitigate them, or explore alternate pricing options.

Simple implementation example:

When you want to get the standard deviation of all your data you can execute a GET request:


This is the easiest way of getting the same information in specific time frames using POST:

Using cURL

curl \
    -H "AuthorizationL READ_KEY" \
    -H "Content-Type: application/json" \
    -d "{
            \"event_collection\": \"COLLECTION_NAME\",
            \"target_property\": \"TARGET_PROPERTY\",
            \"timeframe\": \"this_2_months\"

Using our updated KeenClient-Java:


KeenProject keenProject = new KeenProject(KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY);
KeenQueryClient keenQueryClient = new KeenQueryClient.Builder(keenProject).build();

try {
    standard_deviation = keenQuerytClient
            eventCollection: "<EVENT_COLLECTION>",
            targetProperty: "<TARGET_PROPERTY>",
            new RelativeTimeFrame("<TIME_FRAME>"));
} catch (IOException e) {

Or any other sdk

Thank you for reading!

Filip Szarek
Back-End developer