Modify Denominator in Average Metric

Oracle has recently integrated the elastic stack into one of their products, but it unfortunately does not support visual builder or timelion at the moment. I've tried my best to restore functionality myself from my own personal ELK instances, but get "The request for this panel failed".

Instead of fighting it, I'm hoping some far smarter scripters than myself can help me accomplish what I'm looking for in the standard Metric visualization builder.

The short version is I'm trying to accomplish a Sum(term) / Sum(headcount) metric. The Average metric gets close, but would be incorrect since Average in this instance would be both term and headcount rows.

Term   | employee | headcount
1 | Bob | 0
0 | Jill | 1
0 | Dan | 1
0 | Jan | 1

Proper term calc would be 1/3 and if I had access to visual builder I would use a bucket script, but while stuck using the average metric I get 1/4. Is there any way to modify the Average metrics denominator via JSON? Or does anyone have any others ways of trying to accomplish the 1/3 outside of visual builder?

hi @bsmith

I think this is a known limitation of the agg-based Kibana visualizations.

Support for bucket scripts is a longstanding feature request: Add bucket_selector aggregation to visualizations · Issue #17544 · elastic/kibana · GitHub

Was hoping there was a way to get around needing visual builder, but I'll keep working on restoring that functionality until they make it available.

Managed to get around Oracle's limitations by putting the bucket script query into Vega and using the "Text" Mark.

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