Use coalesce on custom function aggregation

Hello everyone,

I am having a question about how could I do a custom agg function in Metabase

I want a custom function of the format : sum(A) / coalesce(sum(B),1) is that possible? It's important to be done via the UI to use it in a pivot table.

Thanks in advance!

Hi @ilias1111
That is currently not possible. I'm not quite sure where the limitation is, but investigating that.

@flamber Thanks for the incredibly fast answer! If you think is worth the scope I could add a GitHub issue maybe.

My use case of the feature is to create a pivot table for a "long" table (CAT_1, CAT_2, metric, value_a, value_b ) where for some metrics i calculate the ratio A/B and for simple values I could just add value_a.

@ilias1111 You can create an issue about it - I'm still trying to figure out why and where this limitation is.

Just for reference: - upvote by clicking :+1: on the first post