导出时分页 excel- ssrs

Page Break on export excel- ssrs

是否可以按组方式导出输出 excel 以页面名称作为组和以页面名称作为子组的子组方式。

尝试了几个选项,但不能很好地使用分页符和 sheet 名称。

分页-->分组-->之间
分页符 --> 子组 --> Between and End.

以下数据集的预期输出:excel.

中的 5 sheets
  1. 美国 - 子组名称 -Sheet1
  2. CA - 子组名称 -Sheet2
  3. 北美洲 - 带有求和详细信息的组名 -sheet3
  4. FR - 子组名称 -sheet4
  5. 欧洲 - 带有总和详细信息的组名称 - sheet5

示例数据集:

Select 'Area-1' as Region, 'North America' as 'Group','US' as 'SubGroup','Northwest' as 'Detail',7887186.7882  'Sales'
union
Select 'Area-1', 'North America','US','Northeast',2402176.8476  
union
Select 'Area-1', 'North America','US','Central',3072175.118  
union
Select 'Area-1', 'North America','CA','Southwest',10510853.8739  
union
Select 'Area-1', 'North America','CA','Southeast',2538667.2515  
union
Select 'Area-1', 'North America','CA','Canada',6771829.1376  
union
Select 'Area-1', 'Europe','FR','Northwest',4772398.3078  
union
Select 'Area-1', 'Europe','FR','Northeast',3805202.3478  
union
Select 'Area-1', 'Europe','FR','Central',5012905.3656

预期输出:

我会尝试对数据进行不同的分组,以便报告方面的事情更容易。我拿了你的原始数据集,将其转储到一个临时 table 中并像这样分组..

SELECT * INTO #t FROM (
Select 'Area-1' as Region, 'North America' as [Group],'US' as [SubGroup],'Northwest' as [Detail], 7887186.7882 as [Sales]
union
Select 'Area-1', 'North America','US','Northeast',2402176.8476  
union
Select 'Area-1', 'North America','US','Central',3072175.118  
union
Select 'Area-1', 'North America','CA','Southwest',10510853.8739  
union
Select 'Area-1', 'North America','CA','Southeast',2538667.2515  
union
Select 'Area-1', 'North America','CA','Canada',6771829.1376  
union
Select 'Area-1', 'Europe','FR','Northwest',4772398.3078  
union
Select 'Area-1', 'Europe','FR','Northeast',3805202.3478  
union
Select 'Area-1', 'Europe','FR','Central',5012905.3656
) q 

SELECT 
    [Region], [Group], [SubGroup], [Detail]
    , SUM(Sales) OVER(PARTITION BY [Group]) as ContinentSales
    , SUM(Sales) OVER(PARTITION BY [Group], [SubGroup]) as CountrySales
    , Sales as DetailSales
into #s
 FROM #t

SELECT DISTINCT Region, SubGroup as ReportGroup, Detail, DetailSales as Sales FROM #s
UNION ALL
SELECT DISTINCT Region, [Group], NULL, ContinentSales FROM #s

这给出了以下输出

然后您应该能够按报告组进行分组,并将其用作组中的页面名称 属性。