In Report Designer, Groups are created to organize data on the report or to calculate aggregate summaries. An understanding how to define groups and use group features helps you design reports that are more concise and communicate summarized data in a more compact format.
We also use Groups in SSRS reports to provide Drill-down features. In this article, I'll walk you through SSRS Groups to create a report shown in below image:
STEP1: Add new report in Report Server project and rename it to GroupsInSSRS.rdl.
Create new Shared DataSource for database AdventureWorksDW2008R2.
Click here to download AdventureWorksDW2008R2 database.
STEP2: Create a new dataset dsMain with Shared Data Source. Use below query for this dataset:
SELECT
D.CalendarYear AS [Year]
,D.CalendarQuarter AS [Quarter]
,D.EnglishMonthName AS [Month]
,D.FullDateAlternateKey AS [Date]
,P.EnglishProductName AS [ProductName]
,C.FirstName + LastName AS [CustomerName]
,ST.SalesTerritoryRegion AS [SalesRegion]
,ST.SalesTerritoryCountry AS [SalesCountry]
,F.SalesOrderNumber AS [OrderNumber]
,F.SalesAmount
FROM FactInternetSales F
JOIN DimProduct P
ON P.ProductKey = F.ProductKey
JOIN DimCustomer C
ON C.CustomerKey = F.CustomerKey
JOIN DimDate D
ON D.DateKey = F.OrderDateKey
JOIN DimSalesTerritory ST
ON ST.SalesTerritoryKey = F.SalesTerritoryKey
STEP3: Drag and drop a table control and select CustomerName, OrderNumber, and SalesAmount fields in the table.
STEP4: Select table detail row --> Right click --> select Add Group --> Row Group --> Parent Group
STEP5: Select ProductName in Tablix group window and check add group header check box. Click OK and sace changes.
Now you can see Product Group in the table as shown below:
Delete Group1 Column and rename Customer Name as Particulars. Select ProductName in Product Group as shown below:
STEP6: Select ProductName group and add one more group for SalesCountry in similar way mentioned at step5. Delete the group column and select SalesCountry in CountryGroup as shown below:
STEP7: In the same way add Groups for the following Fields:
STEP8: we are done with report Groups. You can Preview the report:
STEP9: Format Groups: This is the final step. Without formatting the tabular data look meaningless and its very difficult to understand the report. You can do following formatting to make it easier to understand:
Similar way toggle other report items.
Also Toggle Order Number column with Particular text box.
Now click on Preview and generate the report:
We also use Groups in SSRS reports to provide Drill-down features. In this article, I'll walk you through SSRS Groups to create a report shown in below image:
Create new Shared DataSource for database AdventureWorksDW2008R2.
Click here to download AdventureWorksDW2008R2 database.
STEP2: Create a new dataset dsMain with Shared Data Source. Use below query for this dataset:
SELECT
D.CalendarYear AS [Year]
,D.CalendarQuarter AS [Quarter]
,D.EnglishMonthName AS [Month]
,D.FullDateAlternateKey AS [Date]
,P.EnglishProductName AS [ProductName]
,C.FirstName + LastName AS [CustomerName]
,ST.SalesTerritoryRegion AS [SalesRegion]
,ST.SalesTerritoryCountry AS [SalesCountry]
,F.SalesOrderNumber AS [OrderNumber]
,F.SalesAmount
FROM FactInternetSales F
JOIN DimProduct P
ON P.ProductKey = F.ProductKey
JOIN DimCustomer C
ON C.CustomerKey = F.CustomerKey
JOIN DimDate D
ON D.DateKey = F.OrderDateKey
JOIN DimSalesTerritory ST
ON ST.SalesTerritoryKey = F.SalesTerritoryKey
STEP3: Drag and drop a table control and select CustomerName, OrderNumber, and SalesAmount fields in the table.
STEP4: Select table detail row --> Right click --> select Add Group --> Row Group --> Parent Group
STEP5: Select ProductName in Tablix group window and check add group header check box. Click OK and sace changes.
Now you can see Product Group in the table as shown below:
Delete Group1 Column and rename Customer Name as Particulars. Select ProductName in Product Group as shown below:
STEP6: Select ProductName group and add one more group for SalesCountry in similar way mentioned at step5. Delete the group column and select SalesCountry in CountryGroup as shown below:
STEP7: In the same way add Groups for the following Fields:
- SalesRegion
- Date
- Month
- Quarter
- Year
STEP8: we are done with report Groups. You can Preview the report:
STEP9: Format Groups: This is the final step. Without formatting the tabular data look meaningless and its very difficult to understand the report. You can do following formatting to make it easier to understand:
Group | Left Indent | BackgroundColor |
---|---|---|
Year | 2pt | #7c73c8 |
Quarter | 12pt | #9894ca |
Month | 22pt | #b4b4c8 |
Date | 32pt | #c7c7d8 |
SalesRegion | 42pt | #dadaeb |
SalesCountry | 52pt | #e7e7f0 |
ProductName | 62pt | #f4f4fc |
CustomerName (detail row) | 72pt | White |
Toggle Groups:
Select Quarter Group and click on Group Properties. Select Visibility in Group Properties and select Hide option button. Check Dispaly can be toggled by this report item check box and select Year from combo box.Similar way toggle other report items.
Also Toggle Order Number column with Particular text box.
Now click on Preview and generate the report:
No comments:
Post a Comment
Hi,
Thanks for your visit to this blog.
We would be happy with your Queries/Suggestions.