In this article we will show you, How to Create SSRS Report using Stored Procedure with example. This is one of the frequently asked question by SSRS followers. In order to demonstrate the same, we are going create a Stored procedure on Adventure Works DW database.
Below screenshot will show you the data that we are going to use in this stored procedure:
IF OBJECT_ID ( 'SP_ProductSales', 'P' ) IS NOT NULL
DROP PROCEDURE SP_ProductSales;
CREATE PROCEDURE [dbo].[SP_ProductSales]
SET NOCOUNT ON;
Prod.EnglishProductName AS ProductName,
FROM DimProduct AS Prod
INNER JOIN FactInternetSales AS Fact
ON Prod.ProductKey = Fact.ProductKey
Create SSRS Report using Stored Procedure
In this example, we are going to create a 3D Clustered Column Chart to display the step by step approach to create SSRS Report using Stored Procedure. Below screenshot will show you the Data Source and Dataset we are going to use for this Clustered Column Chart Report.
Here, we have to change the Query type from Text (which is default) to Stored procedure as we shown below.
Next, Please select the required stored procedure name from the available list. From the below screenshot you can see that, we are selecting the stored procedure that we created earlier.
Lastly, Please navigate to Fields tab, and check whether we got all the fields from our stored procedure or not. Here you can add Calculated Fields also.
In SSRS report design, we can add a Clustered Column chart by dragging the Chart property from the SSRS Toolbox to Design space, or we can simply right click on the report designer to open the context menu. From the context menu, please select the Insert -> Chart option as we shown below.
Once you select the Chart option, a new window called Select Chart Type will be opened to select required chart from the available once. For this example, we are selecting 3D Clustered Column Chart as shown in below screenshot.
Once you click on Ok button, 3D Clustered Column chart will be displayed in design region with dummy data.
By Clicking on the empty space around the Clustered Column Chart will open the Chart Data window. In this example, we will create a Clustered Column chart for the Total Product Cost, and Sales Amount so, Drag and drop them from data set to chart data values, and Product Color in category group. I suggest you to refer Create Column Chart in SSRS article to understand the creation of Clustered Column chart
Click on the Preview button to see the report preview.
From the above screenshot you can see that, we created a 3D Clustered Column chart using the SP_ProductSales stored procedure. Let me Format the chart a bit for classy look. Remember, we already explained the Formatting options in Formatting Column Chart article so, Please refer the article to understand the steps.
Thank You for Visiting Our Blog