Dategrain combined with aggregation

enara_martin ⚪️
edited January 4 in APIs

As I can read here:


Perform a groupby with predefined date grains. By default, numerical columns are summed and unique entries of non-numerical columns are counted. Can be combined with an aggregation to override this default behavior."

I would like to change the default sum to an average. How could this be changed?

My query looks like this:

var dataAggregateBy = 'day';
var dategrain = [dataDateColumnName + ' by ' + dataAggregateBy];
var query = `/data/v1/${datasets[0]} fields=${fields.join()}