Achyutha Mohan
Achyutha Mohan

Reputation: 69

In Tableau how can I create a calculated field that categorizes data based on data across rows?

I have a tableau table that looks like this :

Initial_Dataset

I want the following output:

Desired_Output

Upvotes: 1

Views: 982

Answers (2)

Robert Crocker
Robert Crocker

Reputation: 678

If don't mind only having the 'Part' pill on the view, like this...

Example of where to place your pills

Then the calculation below will meet your needs. Removing 'Types' from the view allows the data to aggregate in a way we can use to come up with the categories you want.

Size Category Calculation Image

However, if you would like to add more dimensions to the view we need to control the level of detail in our calculation. Thankfully, we can do this with LOD functions.

Level of detail calculation

This calculation "fixes" out Level of Detail at the Part LOD. You can see I have added 'Another Dim' the view and it still works.

Upvotes: 2

Kalidas
Kalidas

Reputation: 149

You might want to associate the Type with integer values E.g small =1 , medium = 3, Large = 5. Call this field TypeInt

Create a calculated field Type_Calc = {Fixed [Part]:SUM(TypeInt)}

If Type_Calc = 1 Then Category = "Small" elseif Type_Calc = 4 Then Catgory = "Small_Medium"....

and so on.

Assumption is that the same Type is not repeated within the Part.

Upvotes: 1

Related Questions