Aggregate data based on other column


i am using a pivot table and try to aggregate a column based on another value, in SQL it would looke like this:

case when column1 = 'val1' then sum(column2) else avg (column2) end as aggregated_column
From ...

I tried to use the case expression within the summary custom expression field, but can't make it work:

case([column1] = "val1", Sum([column2]), Average([column2]))

Depending on the value of col1 I need an average or a summed value at the summary row at the end of the pivot table

Hi @Willi
You would currently have to do a double aggregation.
Where the Custom Expression is something like:
Sum(case([Category] = "Doohickey", [Average of Rating], [Sum of Price]))