I'm currently working on a report in SSRS (SQL Server Reporting Services) where my data source is Databricks, accessed via ODBC. The report requires implementing a multi-select parameter for filtering results based on office names.
I have a SQL query that works perfectly with a single-select parameter using a question mark ? as a placeholder for dynamic input. However, I'm struggling to modify the query to support multi-select parameters. The query is supposed to filter results based on multiple office names, but I'm unable to pass a list or array to the single placeholder used for the IN clause. Here is the part of the query causing issues:
SELECT DISTINCT
dimpractice.PracticeId,
dimpractice.PracticeName AS Practice
FROM curated.dimprojectmaster
INNER JOIN curated.dimorganization
ON dimprojectmaster.OrganizationID = dimorganization.OrganizationID
INNER JOIN curated.dimpractice
ON dimorganization.PracticeID = dimpractice.PracticeID
INNER JOIN curated.dimprofitcenter
ON dimorganization.ProfitCenterID = dimprofitcenter.ProfitCenterID
INNER JOIN curated.dimoffice
ON dimprofitcenter.OfficeID = dimoffice.OfficeID
AND dimprojectmaster.ChargeType IN ('Regular', 'Promotional')
AND dimoffice.OfficeName IN (?)
ORDER BY Practice
dimoffice.OfficeName IN (?) -- This is where the problem occurs with multi-select