5 Replies Latest reply on Jul 21, 2016 4:43 AM by khalid norat

# Using parameters within an (aggregation) calculated field

I'm struggling with a Tableau puzzle. (Please see the attached workbook for a mock up).

I created a parameter names Customer List, so that I'm able to use 'All Customers' as a filter option (and not just the 'All' option, which would display all filter options - common workaround I've seen).

You'll see the calculation with the Margin (par) and Revenue (par) field, both with similar logic:

I would like to create a calculated field that calculates Margin % per customers. Here is how I've defined it (using the attr() function to avoid the 'Cannot mix aggregate and non-aggregate arguments' error:

However - the field doesn't appear to calculate anything, when I pull it into the table:

Help!

• ###### 1. Re: Using parameters within an (aggregation) calculated field

Hi Ammanuel,

Have a look at the attached Sheet 2.

I have not used the parameters but have created something that gives you the same effect.

Hope this works for you.

• ###### 2. Re: Using parameters within an (aggregation) calculated field

That is awesome!! Thank you!!

• ###### 3. Re: Using parameters within an (aggregation) calculated field

khalid norat additional question for you.

Within the worksheet you created, supposing you wanted to group two of customers together. Let's say you wanted to group customer A and customer B together into a new customer, customer Z. BUT, you didn't want to lose the ability to look at customer A and customer B separately. In short, you wanted to have the filter read:

All Customers

Customer A

Customer B

Customer C

Customer D

Customer E

Customer F

Customer Z

How would you do that?

Thanks again!

• ###### 4. Re: Using parameters within an (aggregation) calculated field

Within the worksheet you created, supposing you wanted to group two of customers together. Let's say you wanted to group customer A and customer B together into a new customer, customer Z. BUT, you didn't want to lose the ability to look at customer A and customer B separately. In short, you wanted to have the filter read:

All Customers

Customer A

Customer B

Customer C

Customer D

Customer E

Customer F

Customer Z

How would you do that?

Thanks again!

• ###### 5. Re: Using parameters within an (aggregation) calculated field

Just to clarify are you trying to select set customers and aggregate as customer Z

or are you trying to give the user the ability to select any combination of customers and aggregate them as customer z

i

1 of 1 people found this helpful