Say I have a dataset in SSRS called DataSet1 that looks like this:
CREATE TABLE #data
(ID int, Value int, UserID varchar(2))
INSERT INTO #data VALUES
(1, 1000, 'AA'),
(2, 2000, 'AA'),
(3, 3000, 'BB'),
(4, 2000, 'BB'),
(5, 1500, 'BB'),
(6, 1800, 'BB'),
(7, 1700, 'CC')
..and that my report just presents this as a table.
Let's then say I want to add a parameter in that report, that let's the user filter the table by UserID. I want it to be a multiple value parameter where they can choose which users to include in their report. In this case I want the list to be AA, BB and CC.
So far I have done it by creating an extra SQL query based dataset like this:
DataSet1:
SELECT ID, Value, UserID
FROM table
DataSet2:
SELECT DISTINCT UserID
FROM table
And then have the parameter get its available values from DataSet2. However the query I have in my particular report is a very long and complex query, that I would prefer to not use in two datasets. If I have to go back and change something in the query, I would have to maintain that in two places, and so on.
In short: Is there a way to have the available values of my parameter by something like this: SELECT DISTINCT UserID FROM DataSet1
Thanks!