We are trying to create a visualization to show percentage increase and decrease in number of messages. We are getting a count of this increase and decrease by using '.derivative()' function in Timelion. However, to convert it to the corresponding percentage, we need to divide it by last corresponding time-range's day. So if we have selected last 24 hours on the global time filter in Kibana, we need to get data for last day(-24h). We tried using 'offset' function, but it takes hardcoded values, which don't change when we change the time range in the global time filter. Say, if we make it last 7 days, 'Timelion' would still offset data by last 24 hours. We also tried using 'Offset: Timerange', but for this too to work, we need to change the (multiplication) factor we give(say, '-1') when we change the time range.
In an another graph we are trying to calculate 'Average number of sessions per 24 hours'. For this too, we need divide the the total count of sessions by the number of days selected in the time range of the global time filter.
Any suggestions how can we implement this ? Is there a way to get the current selected time-range in Kibana's (may be in form of a variable) global time filter ?
P.S: 'global time filter' means the option given on the top-right corner on Kibana dashboard to change the time range