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:
Thats all about Report Groups...
Cheers!!!
Hi,
ReplyDeleteHow do i hide and unhide the column based on row toggle...
My report looks something like this
Category Product OrderId Amount
Bevrages Cooldrinks ORD123 120
So if i group on Category and display the Sum of amount, on hide of row product and OrderID will be blank. So in that case when it is + i want ti display Category and Amount and when it is - i want to display all columns