How to calculate conditional sum on y axis

Is there a way to represent/calculate the following for y axis :
sum = 0;
for all items in the index :
if condition 1 : then sum = sum+ m
if condition 2 : then sum= sum + (1.3m)
if condition 3 : then sum = sum + (1.5

return sum;

where m is a numeric field in the index used.
And this should calculate sum for all the independent filters in split series.
Over x axis I have aggregation of Date Histogram.

Hm, if I'm following you correctly, perhaps this is something you could achieve with Runtime fields in which case you'd pre-calculate the values of m into a new field and use sum on that?

1 Like

Thanks, I used the approach you suggested and it works as expected.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.