KNOWLEDGE BASE

How To Compare Column Having Multiple Values Separated By Delimiter With Each Of The Multi Valued Parameter Inputs


Published: 09 Jun 2020
Last Modified Date: 10 Jun 2020

Question

How to compare column having multiple values separated by delimiter with each of the multi valued parameter inputs. Example: Compare a field like Category having values like Furniture | Technology with individual values of multi valued parameter input like Furniture | sample

Environment

  • Tableau Desktop

Answer

1. Create a parameter with multi-valued inputs. For example: Furniture|sample
2. Create a calculated field called Compare with formula like below where Text column is the field with multiple values separated by delimiter "|":

if CONTAINS([Text column], SPLIT([Parameter 3],'|',1))  then "True" 
ELSEIF  CONTAINS([Text column], SPLIT([Parameter 3],'|',2))  then "True" 
else  "false"
end

 

Additional Information

Split() function returns a substring from a string. For example: Split('Furniture|sample','|',1 ) gives Furniture
Contains() Returns true if the given string contains the specified substring.
Did this article resolve the issue?