5 Replies Latest reply on Sep 3, 2018 1:27 AM by Tristan Roper-Caldbeck

# Formula for grouping data

Hi there,

I am having a problem building a formula in tableau for the below screenshot. I am inputting raw data that I have worked up in Alteryx, however, I want to divide the data in groupings - "Apples", "Oranges", "Bananas" or "Multiple" - depending on whether that truck is supplying 1 type of fruit (take singular name) or 2 or more types of fruit (Multiple).

The next step to the problem is that the truck varies between supplying just 1 product in some locations and multiple in other locations, which I want to capture. For example, Truck 1 supplies multiple items in Singapore (apples, oranges and bananas), but only supplies 1 item (oranges) in Penang.

Tristan

• ###### 1. Re: Formula for grouping data

Hello Tristan,

Please refer to the attached workbook for details.

One thing which is different to your screenshot is that, in the truck counts, "BANANA" is not shown.

Regards

Lei

• ###### 2. Re: Formula for grouping data

Hi Lei,

You've noticed my mistake -- my early morning brain!

The attachment solves my problem - thank you very much for your help!

Regards,

Tristan

• ###### 3. Re: Formula for grouping data

Hi Lei,

I am very sorry to bother you again, but I have met a problem with the issue you solved so well before. Now I have introduced some new data, I am getting nulls come through within the 'supplying' column. And, instead of the Item (Truck) being counted once with regard to what it is supplying, the item is being counted twice if there is a null - for example Truck 4 supplies both Apples and Null, therefore, appears in both, instead of just Apples. Whereas, if a Truck has all nulls (Truck 5) I want this to appear in 'Null' only. Do you have any advice on the best way to solve this?

Regards,

Tristan

• ###### 4. Re: Formula for grouping data

Hello Tristan,

Don't feel sorry, and further question is welcome

I modified the calculated field, and Truck 5 is not double counted now.

Please refer to the attached workbook for details.

Regards

Lei

1 of 1 people found this helpful
• ###### 5. Re: Formula for grouping data

Hello Lei,

Thanks so much for your help once again - you've solved the issue perfectly!

Thanks a lot!

Regards,

Tristan