When you're creating business reports, you'll likely need to occasionally show the data to side-by-side in a single report. Examples might include comparison of sales data over years, assets and liabilities in a balance sheet, or a production report of different regions. In this blog, we'll see how we can use the Tablix data region to create a side-by-side layout report.
Although you can create side-by-side layouts using subreports, I wouldn't recommend using subreports for the following reasons:
ActiveReports DataRegions — such as List, Table, Tablix, and Banded List — are a good alternative to subreports for creating side-by-side layouts. Not only can they display data in a single report by making use of separate groups, but since the data is only processed once, they're much more efficient than subreports.
Our example will include creating a side-by-side report using the Tablix data region to create a side-by-side layout report, as shown below, using Adjacent Groups by taking monthly sales performance of two employees.
To create the desired side-by-side layout, we'll need two column groups, so we'll perform a series of operations:
To delete the row group, you can do either of the following
To remove the column of the deleted row group, right-click on the corner cell and select the "Delete Column" option in the context menu. You'll get a structure like shown:
Note: If you need to place data vertically adjacent, you may keep the Row Group instead and delete the Column Group.
To learn more about Tablix and its structure, read the documentation.
Now we need to add a new Column Group adjacent to the current group. It'll look like this:
Next, we'll add more details to both column groups in the Tablix. The structure may include:
After adding the details, the Tablix in this report will look like this:
Next, we'll bind the Tablix with the desired fields.
For this report, we've used NorthWind DataSource and added datasets based on Orders, OrderDetails, and Employees tables in the database. Using the fields selection adorner, bind the controls with desired fields in both column groups to get the layout as shown below:
Note: To fetch sales data from the Orders and OrderDetails tables in the embedded Table control, we've used the Dataset Joins available in ActiveReports 12.
Next, we'll add the parameters required to select the aspects for comparison in the report. We'll display data for two employees, and so we'll add parameters for selecting the respective employees to compare the sales performance. In addition to this, we'll add a parameter to select the month for which sales data is to be compared in the report.
Next, we'll add group expressions and filters so the column groups can display the details corresponding to the selected aspects.
In this report, we'll add group expression on the EmployeeID field to categorize the data by employees, and then add a group filter on the employee parameters added in step 3 to the respective column groups. For example, filter is added for the first column group using one of the parameter in the report, as shown here:
The final step for this report design is to polish the layout and add styles to make it looks like this:
Once we're done with the above steps, we can always preview the report in the viewer to see the output:
Please note: to run the sample report attached in this blog, you must edit the data source connection to your copy of the Northwind database. If you have ActiveReports installed, you can locate the database at "C:\Users\
Download EmployeeSalesPerformance.rdlx to see the side-by-side report using Tablix.