Parameters are only single-valued, so there's no way to do this.
I don't know if this helps, probably not unless you know the combinations you would want ahead of time, but the parameter can take a longer part of the statement - in the following:
[Orders$].[State] AS [State],
[Orders$].[Unit Price] AS [Unit Price],
[Orders$].[Zip Code] AS [Zip Code]
FROM [Orders$] where <Parameters.Parameter 3>
The parameter is set to:
[Product Category] = "Furniture" or [Product Category] ="Technology"
That would actually work, because I DO know the values I would want to pipe in. However, I've tried reproducing your query, and it doesn't seem to be working for me. I'm guessing the problem might be that I'm pulling data from Microsoft SQL Server, and the parameter should take a different form. I've tried:
[CustomerLastName] = "Smith" OR [CustomerLastName] = "Johnson"
[CustomerLastName] = 'Smith' OR [CustomerLastName] = 'Johnson'
Both end up giving me an error. Do you know if Tableau automatically adds characters on either end of a string that might not play well with SQL Server? Is there some alternate way that I can still pull live data from SQL Server and also feed the custom query multiple values in the string parameter?
That was JET connected to an Excel file - is the code the same for SQL? You could try looking in the logs and see what Tab sent as a query.
The query itself is in the logs in your repository. Usually My Documents\My Tableau Repository\Logs.
But what Alex is suggesting you do should not work. Tableau quotes the values before adding them to the custom SQL to prevent SQL injection attacks and make parameters behave as you would usually expect.
[Johan's suggestion is fine, but doesn't sound like it is what you need.]
1 of 1 people found this helpful
Sure. The where part of the query is straightforward:
WHERE CustomerLastName IN ( <Parameter> )
The data consist of multiple rows per customer, so the filter would return multiple rows per each additional name added to the parameter. Feeding a single value (e.g., Smith) works fine.