November 24, 2013

Section based headers – SSRS

I got an interesting requirement this week. My client has requested for Claim Movement report in different currency and currency profile. He also asked whether it is possible to show exchange rate only for certain profile. I don’t want to add another column; instead I went to show an additional header only for certain currency profile
Example output

Let us take a simple example from Adventure works to illustrate the problem

Database: AdventureWorksDW2008R2
Tables: FactInternetSales, DimCurrency and DimSalesTerritory
Scenario: Report the Sale amount grouped by Territory and currency. Also show an additional header with “Test” only when the customer name is “US Dollar”
Create a report with below Report Query: (Let us use the SSRS grouping)
SELECT ster.SalesTerritoryRegion RegionName


, fis.SalesAmount

FROM [dbo].[FactInternetSales] fis

JOIN dbo.DimSalesTerritory ster ON fis.SalesTerritoryKey = ster.SalesTerritoryKey

JOIN dbo.DimCurrency cur ON cur.CurrencyKey = fis.CurrencyKey

Group the results based on Territory and Currency in the SSRS.
Section the reports based on Territory

Sample view of the report

Page 1:
Last page:

Now we want to show an additional header just for the USDollar.

Step1 : Insert an additional row above the currency group.

Step 2: Open the grouping pane in advanced mode
Step 3: select the newly added row group column and find the static element
Step 4: Open the properties pane of the Static element and select the visibility Criteria as shown below
Against the hidden parameter enter the below expression. This will show the row only when Currency name is US Dollar
=iif(Fields!CurrencyName.Value = "US Dollar",False,True)

Final Output

Page 1: No additional Header for the Canadian Dollar Section
Last Page: Us dollar with additional Test Header
As you can see Headers can be shown based on sections.
Happy Learning Smile

No comments:

Post a Comment