We are working on a complex dashboard that allows the users to select a field on which they want to perform a comparison, and to select a list of values for two groups (comma separated) – then the dashboard calculate a result for each group and compares both results.

Since the association with each group is completely dynamic (SelectedField can be any of 20 different fields), we can’t prepare any calculation in advance and we need to calculate everything on the fly.

Running the queries directly against Oracle doesn’t perform good enough, so we’ve decided to use extracts. Currently with the way Tableau extract works, we need to decide at the row level if the row belongs to each group, and the performance of that isn’t very good. It would be much more efficient if we could first perform an aggregation on the field, and only then perform the computation, but since each group contains multiple values, it seems impossible with Tableau extract.

Is it indeed impossible, or is there a work-around that will allow us to do it?

A simplified version of the current query that is performed:

*Select *

sum(if Contains([Group1SelectedValuesParam], [SelectedField]) then 1 else 0 end * [AR]*[[Volume]])/SUM([Volume]) as Group1Result,

sum(if Contains([Group2SelectedValuesParam], [SelectedField]) then 1 else 0 end * [AR]*[[Volume]])/SUM([Volume]) as Group2Result

From Extract

Where --Complex where condition

The query that we want to perform:

*Select *

sum(if Contains([Group1SelectedValuesParam], [SelectedField]) then 1 else 0 end * [AR]*[[Volume]])/SUM([Volume]) as Group1Result,

sum(if Contains([Group2SelectedValuesParam], [SelectedField]) then 1 else 0 end * [AR]*[[Volume]])/SUM([Volume]) as Group2Result

From

(select SelectedField, [AR]*[[Volume]])/SUM([Volume]) as AR, SUM([Volume]) as Volume from Extract Where --Complex where condition Group by [SelectedField])

Any help would be much appreciated!