Comparing metric over two time duration under same index

Hi,

I am trying to find a way to visualize a bar chart displaying a metric value side by side (two different time periods), from the same index.
Example : Comparing avg. attendance of class for 15 days of April month with same of May when I have attendance for all days under same index
Any thoughts which aggregation/filter can be used.

Yes you can do this.

EDIT : OOPS / apologies I did not read your request well you wanted a Bar Chart, I gave a line chart.... let me think about the bar chart but in the mean time here is a line chart :slight_smile:

Create Visualization -> TSVB

Set the time picker to the right time scale.

Under Panel Options Make sure to set the index pattern to your index pattern

Create a times series
Average of Field (the attendance field) it will need to be numerical. Where you see system.load.1 in my picture put your attendance count field.

Create Another Time Series
Change the Color
Open Options and Change the Offset
And you will have 2 series of the same data offset by 14 Days
Save and put on a Dashaboard.

@SUMANTA_ROY, welcome to the community!
This one got me scratching me head a bit but I think I've worked out a way you can do this.
I used the ecommerce sample data set that Kibana provides by default. I know it's not exactly the same as the data set you're working with but I hope it illustrates how you can achieve your desired visualization.

I was able to create the following visualization that shows and average of a metric (in your case, it would be the attendance count per day) on the Y-axis, bucketing with a split series on the date field, followed by setting the X-axis Sub aggregation as a Date histogram:

You'll have to 'tweak' your Date Range aggregation math (change now-10d/d -> now-5d/d to now-30d/d -> now-15d/d and now-5d/d -> now to now-15d/d -> now) and you can add more date range buckets.

I hope that gets you to where you need to go!

Thanks for your response. I am sorry as I could not probably explain the requirement clearly and I probably over simplified with that example. In actual case those events happen randomly, so calculating the offset from one another is really difficult. Instead, I would have like to select the absolute time range if possible anyway and just compare the avg. between two time duration (fine with bar/line).

sample

Hi @SUMANTA_ROY

I think what you desire may be difficult but I did just realize That you can use the Line method I described above and Get the comparative bar charts

Today Kibana visualizations works off a single date range then with an offset from that, it does not readily support Two separate date ranges overlaid.

Elasticsearch does have JDBC ODBC connectors so perhaps you could use another visualization tool such Tableau.

Also there is support for Vega visualizations but those require custom programming.

One thing really cool about Elastic is that you could actually go to kabana GitHub repository and open your feature request and it could be considered / no promises.

Unfortunately, I think that is all I have for you...

Perhaps someone else can come up with something.

Hi @stephenb - thanks for your response.

I will try out other visualization tools as suggested or probably need to find out a way to calculate the offset easily. Thanks again for your response.

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