• Home
  • Blog
  • SSRS
  • Getting Started with Sparklines in SQL Server Reporting Services

Getting Started with Sparklines in SQL Server Reporting Services

SSRS Sparklines

Sparklines are small charts that you can embed into cells of a table or matrix. Because of their size, they do not show labels or a legend, although there are many similarities with the charts you use in other parts of a report.

Because of their small size and lack of labels, sparklines are best used to show trends over time, or for comparing rows of data. In the example used in this section’s Try it, the sparkline will show trends of sales over a year for each salesperson. The reader will be able to see which salesperson is increasing sales over the year, but the sparkline will not provide any values.

If you would like to become an SSRS (SQL Server Reporting Services) certified professional, then visit Mindmajix - A Global online training platform: "SSRS Training and Certification Course". This course will help you to achieve excellence in this domain.

Because sparklines use a series of data values, they must be placed in a cell that is part of a group.

Because sparklines are usually used to compare data presented in a column, it is common to align the data points with other sparklines in that column so that the reader can quickly look down the column and compare rows.

Getting Started with Sparklines in SQL Server Reporting Services
SPARKLINES SHOWING TRENDS INSIDE A TABLE ROW

Try it

1. Create a new report called Sparklines with a report data source that references the shared data source in the project.

2. Create a dataset with this query:
SELECT
          MONTH(soh.OrderDate) AS [Month],
          p.FirstName + p.LastName AS FullName,
          SUM(soh.TotalDue) AS TotalDue
FROM
          Sales.SalesOrderHeader soh
          INNER JOIN Person.Person p
          ON p.BusinessEntityID = soh.SalesPersonID
WHERE
          YEAR(soh.OrderDate) = 2007
GROUP BY
          p.FirstName + p.LastName,
          MONTH(soh.OrderDate)
ORDER BY
          [Month],
          FullName

MindMajix Youtube Channel

                                                                            (Related Page: SQL Server Reporting Services SSRS Indicators)

3. Drag a Matrix onto the report design surface

4. From the dataset, drag Month onto the Column cell, FullName onto the row cell, and TotalDue onto the data cell

5. Preview the report and supply the year parameter to check that it shows one row for each person, and one column for each month, with the total sales in the data cells

6. Back in Design view, right-click on the Month column header and choose Insert Column > Outside Group – Right.

7. From the Toolbox, drag a Sparkline onto the second row of the new column.

8. Select the default column type and click ok

default column type

9. Click on the sparkline to open the Chart Data window and use the + icon to add the TotalDue field to the list of values.

10. Add a category group and select Month.

11. Right-click on the sparkline and choose Horizontal Axis Properties.

12. Tick the box to ‘Align axes in’ and accept the default selection (which will be the name of the Matrix). Click OK and preview the report.

Align axes

                                                                                  (Related Page: How To Format a Table Report in SSRS)

 

Frequently Asked SSRS Interview Questions & Answers

List of Related Microsoft Certification Courses:

 SSIS Power BI
 SSAS SQL Server
 SCCM SQL Server DBA
 SharePoint BizTalk Server
 Team Foundation Server BizTalk Server Administrator

 

Course Schedule
NameDates
SSRS TrainingNov 02 to Nov 17View Details
SSRS TrainingNov 05 to Nov 20View Details
SSRS TrainingNov 09 to Nov 24View Details
SSRS TrainingNov 12 to Nov 27View Details
Last updated: 03 Apr 2023
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read less