Hi Henrique, I think solving your problem will be a two-step process.
-
You'll need to create a per-document field for
cost * volume
, e.g. a field calledvolumeCost
. You could create this field two ways, either by reindexing your data and adding the field with a Painless script, or by creating a scripted field that calculates this value on the fly. The first option is a little more performant when querying your data but the second option might be easier. -
I think you can create a Timeseries visualization in the Visualize app to generate the table you want. In the screenshot below, imagine the first aggregation for
products.base_price
is actually a reference to thevolumeCost
field and the second aggregation forproducts.quantity
is actually a reference to thevolume
field. This way you can define a bucket script that performs the calculation you want, and order the results by product ID or name in a table.