I'm using SQL Server 2014 and Reporting Services and I've got a report containing a number of linked subreports. The main report I have will be different for each customer I produce the report for and will contain different text, but I need to pass a customerID to the subreport in order to filter the following query:
SELECT V.vCenterName, COUNT(DISTINCT M.VMName) *1.0/COUNT(DISTINCT M.Hostname) AS VMsPerHost FROM dbo.VMs M INNER JOIN dbo.vcenters V ON M.vCenterID = V.vCenterID WHERE M.vCenterID LIKE V.vCenterID GROUP BY V.vCenterName ORDER BY VMsPerHost DESC
If I can declare a VARCHAR variable before the query and then pass the customerID from the main report to the subreport, I can filter the data by the specific customer only and do this for each main report. How would this be done though. I know there's an option to work with parameters but I don't understand how it works.
Thanks in advance
Adam