Sparklines in SSRS

Sparkline in SSRS

In this article, I will show you how to use Sparkline in SSRS.

1. First of all open Visual Studio 2010 and open your SSRS project.Then add report named as DemoSparkline in your project.

Now create a Dataset. In the dataset, we will use following query

SELECT      PC.Name AS ProdCat, ROUND(SUM(SOD.LineTotal),2) AS Sales,DATENAME(MONTH, SOH.OrderDate)as OrderMonth
FROM        Sales.SalesOrderHeader AS SOH
INNER JOIN  Sales.SalesOrderDetail AS SOD ON SOH.SalesOrderID = SOD.SalesOrderID
INNER JOIN  Production.Product AS P ON SOD.ProductID = P.ProductID
INNER JOIN  Production.ProductSubcategory AS PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID
INNER JOIN  Production.ProductCategory AS PC ON PS.ProductCategoryID = PC.ProductCategoryID
WHERE       DATEPART(YEAR, SOH.OrderDate) = 2007

2. Then right click on report area and go to Insert–>Table.

2-Sparklines in SSRS

3. Now select ProdCat in first column.

3-Sparklines in SSRS

4. Then right click on ProdCat Textbox and select Row Group –> Group Properties.

4-Sparklines in SSRS

5. A Group Properties page opens. In that add Group Expression as shown in below screenshot. Then click on OK button.

5-Sparklines in SSRS

6. Now drag & drop Sparkline control into 2nd column.

6-Sparklines in SSRS

7. A Select Sparkline Type window opens. In that select Line Type as shown in below screenshot. Then click on OK button.

7-Sparklines in SSRS

8. Now your report design looks like below.

8-Sparklines in SSRS

9. Then double-click on Sparkline chart and select value in Chart Data window as shown in below screenshot.

9-Sparklines in SSRS

So we have done with Sparkline in SSRS.

10. Now click on preview tab to see the results. You will see results like below screenshot:

10-Sparklines in SSRS

Congratulations! We successfully created Sparklines in SSRS.