cube icon indicating copy to clipboard operation
cube copied to clipboard

Custom calculated fields

Open Namec999 opened this issue 5 months ago • 1 comments

Problem

I am wondering if it's possible to add custome calculated fields at run time (when executing a query)

Ex : field 1 = measure 1 × measure 2.

And then use the field 1 in my ui.

Currently my workaround is sending all the required measurea and add the custom fields locally. But this approach have many limitations.

Best

Namec999 avatar Oct 04 '25 07:10 Namec999

@igorlukanin I'd love your thoughts here - I imagine this is also a case where this flexibility limits the utility of pre-aggregations (see discussion in https://github.com/cube-js/cube/issues/10042).

I'd also be very interested in this feature - even at the cost of pre-aggregations.

It seems like in general there might be some tension between supporting some flexible and powerful Query features when they're at odds with pre-aggregations. I'd love if Cube could support more powerful query options even if they come at the expense of pre-aggregations - and allow users of Cube to determine if flexibility (query time calculated fields here, or timeDimension granularities in #10042) or performance (pre-defined measures here, or custom granularities in #10042) is right for them.

hank-sq avatar Oct 14 '25 16:10 hank-sq