2013-03-06 180 views
0

我創建了一個參數,讓多個選項給用戶:多選擇在報表生成器3

Total Amount = Grand Total 
Region 1 = Total Amount for that Region 
Region 2 = Total Amount for that Region 
Region 3 = Total Amount for that Region 
Region 4 = Total Amount for that Region 

地區1〜4的偉大工程,但是當我選擇總量我得到的金額不正確。

有人可以告訴我我做錯了請。

主數據集

 SELECT  OccupancyDetail.CalendarYear, OccupancyDetail.CalendarMonth, SUM(OccupancyDetail.No_of_Nights) AS No_of_Nights, 
         SUM(OccupancyDetail.Capacity) AS Capacity,Site.BDM,Site.Region 
FROM   OccupancyDetail INNER JOIN 
         Site ON OccupancyDetail.Site_Skey = Site.Site_Skey 

         WHERE (OccupancyDetail.ReferenceDate = convert(Date,getdate())) 

         AND 
         CASE WHEN @Time = 'YEAR' THEN CAST(CalendarYear as varchar(4)) else 
         CalendarMonth + ' ' + CAST(CalendarYear as varchar(4)) end in (@Dates) 
GROUP BY OccupancyDetail.ReferenceDate, OccupancyDetail.CalendarYear, OccupancyDetail.CalendarMonth,Site.BDM, Site.Region  
Time Dataset 

select DateChoice FROM 
(select distinct CalendarYear, 1 as MonthNumber,CAST(CalendarYear as varchar(4)) as DateChoice from Time 
where @Time = 'YEAR' 


union all 

select Distinct CalendarYear, MonthNumber,CalendarMonth + ' ' + CAST(CalendarYear as varchar(4)) as DateChoice from Time where @Time = 'MONTH') as QRYDATA 
ORDER BY CalendarYear,MonthNumber 

BDM數據集

SELECT DISTINCT BDM 
FROM Site 
+0

你能舉個例子嗎? – Chepene 2013-03-06 14:01:53

回答

0

報告服務參數提供一個內置(Select All)值時定義多個值的參數。

Select All Parameters

對於示例:

  1. 刪除從參數的可用值列表中的Total Amount = Grand Total選項。
  2. 修改您的數據集查詢以接受region參數的多個值。例如:... WHERE REGION IN (@Region)
  3. 檢查Allow multiple values選項的參數屬性 Multiple value parameters
  4. (Select All)從最初的設計取代了Total Amount = Grand Total
+0

嗨Beargle 我允許多個值如上,我得到我的查詢可用的值,這有地區1,地區2等,但是當我勾選全部它給我的區域1的結果,而不是。 謝謝 – wafw1971 2013-03-06 15:08:30

+0

@ wafw1971檢查上面答案中的步驟3。請編輯您的問題併發布數據集中使用的查詢。 – Bryan 2013-03-06 15:10:01

+0

我已經完成了第3步沒有任何更改,我已經根據請求複製了上面的數據集。 – wafw1971 2013-03-06 15:17:08