ashubhargave
ashubhargave

Reputation: 230

Filter comma separated values in Tableau [ Filter Paramters with unique values ]

My table has two columns,

X_ID                                                     Code

234324_sfsdf_ADA, INT                                  ADA, INT      `

343424_gdfg234_LMR                                        LMR 

1233_dfgdfg_QXT                                           QXT

5423_tsdg_OLI                                             OLI

I want to create a new filter in Tableau which has unique values of codes as [ADA, INT, LMR, QXT, OLI] and then I need to check in X_ID Column if the code appears in X_ID.

For now, what i have done is

  1. Separated the code into two columns code1, code2
  2. I have created a parameter named "parameter1" which has all unique values from code1, code2
  3. Then I am creating a calculated field where i check

IF CONTAINS([X_ID],[Parameter1]) THEN [Parameter1] END

The output of above step is ,

parameter1 = [ADA,INT,LMR,QXT,OLI]

The problem here is that Parameter1 only checks for its first value. So, In my case the Parameter1 has first value as ADA. So, the condition of CONTAINS([X_ID],[Parameter1]) is checked only for value ADA and not other values of parameter1.

My questions are:

  1. What should be done so that for all the values of parameters the X_ID is checked.
  2. If that's not possible is there any other way to achieve this task

Upvotes: 1

Views: 2197

Answers (1)

Alexander
Alexander

Reputation: 1967

I am not really sure what exactly you are doing there, but try it this way:

  1. Create a parameter with all unique code values you might have
  2. Create a calculated field CodeFilter with CONTAINS(LOWER([Code]), LOWER([Parameter])) (The LOWER() makes sure that you don't run into problems in case there are mixed case values)
  3. Drag [CodeFilter] to the filter shelf and filter for True values

That should create a filter to fit your requirements

Upvotes: 1

Related Questions