We (www.arpa.piemonte.it) have a minor but annoying issue when creating a custom expression based on aggregations.
In the query builder we create some aggregations in a certain order, then we use the aggregated values to build one or more custom columns.
If, for any reason - mainly for better following a logic procedure - we change the order of the aggregation in the query builder (that is very easy to do by dragging the labels), the custom columns are no more correct.
The problem is that custom columns are still referring to the aggregated values in the position held at the moment that were created and not to the name or label of the aggregation meant to be used.
It wasn’t easy to be aware of the problem, that we think is due to the extensive use of aliases in the sql but we have no idea if there is a solution.
So, be aware of that in the meanwhile Metabase evolves and suggest a fix.
In the first screenshot the column Incenerimento (D10) is [Somma di Incenerimento] / [Somma di Totale gestito] so the aggregation in third place divided by the aggregation in the fourth place.
In the second screenshot we changed the order of the aggregations and Incenerimento(D10) became [Somma di Trattamenti preliminari R] / [Somma di incenerimento], still the aggregation in third place divided by the aggregation in the fourth place even if we initially put a different column name in the function.