In this example, we will add the year and month parameters to the report generated in the previous section. You need to perform the following steps after the execution of the previous example to add parameters to a report:
Open the Sales by Product and Territory reports that were created in the previous example, and in the Report Data pane, right-click on Dataset and select Add Dataset.
In the Dataset Properties window, rename the dataset to
Years
.Select the Use dataset embedded in my report option. Choose Data source as AdventureWorksDW2012. Then, in the query box, type in the following query to fetch all years from the FactInternetSales table:
SELECT distinct (OrderDateKey/10000) as [Year] FROM FactInternetSales
The following screenshot shows the Dataset Properties window:
Close the Dataset Properties window and then right-click on DataSet1 and select Query.
In the query designer window, add the following script line at the end...