2014-06-10 5 views
0

나는 막대 차트에 연체 된 인보이스 정보를 표시하는 보고서를 가지고 있습니다.SSRS 차트에서 하위 보고서를 사용하는 방법은 무엇입니까?

각 막대에는 총 지연 기한 인보이스의 범위가 표시됩니다. 예 : 인보이스 발행 건수가 45 일 이상, 인보이스 발행 건수가 31-44 일, 인보이스 발행 건수가 21-30 일 등입니다.

차트에서 막대를 클릭하여 클릭 한 범위의 모든 송장에 대한 모든 인보이스 세부 정보를 표시하는 하위 보고서를 열려고합니다.

예를 들어 45+ 막대를 클릭하면 45 일 이상 기한이 지난 인보이스에 대한 모든 인보이스 세부 정보가 표시됩니다.

필요한 모든 필드가있는 하위 보고서를 만들었지 만,이 보고서는 클릭 한 막대의 범위 내에있는 것만이 아니라 테이블의 모든 송장을 표시합니다. 다음 표가 생성됩니다

WITH Temp ([Description], [Amount], [OverdueBy]) 
AS 
(select Description, SUM(Amount) as Amount, (DATEDIFF(day,DueDate,GETDATE())) as OverdueBy from brvAPAllInvoices 
Where PaidDate is null and APCo = 1 
Group By Description, DueDate 

) 


SELECT CASE WHEN OverdueBy >= 46 THEN 'Overdue by 46+ days' 
      WHEN OverdueBy >= 31 and OverdueBy <= 45 THEN 'Overdue by 31-45 days' 
      WHEN OverdueBy >= 15 and OverdueBy <= 30 THEN 'Overdue by 15-30 days' 
      WHEN OverdueBy >= 8 and OverdueBy <= 14 THEN 'Overdue by 8-14 days' 
      WHEN OverdueBy >= 1 and OverdueBy <= 7 THEN 'Overdue by 1-7 days' 
      WHEN OverdueBy <= 0 and OverdueBy >= -7 THEN 'Due in 0-7 days' 
      WHEN OverdueBy <= -8 and OverdueBy >= -14 THEN 'Due in 8-14 days' 
      WHEN OverdueBy <= -15 and OverdueBy >= -30 THEN 'Due in 15-30 days' 
      WHEN OverdueBy <= -31 and OverdueBy >= -45 THEN 'Due in 31-45 days' 
      WHEN OverdueBy <= -46 THEN 'Due in 46+ days' 
ELSE 'Less than that' END AS OverdueRange, 
Count(*) as OverdueCount, 
Sum(Temp.Amount) as [Total Amount] 
From Temp 


group by CASE WHEN OverdueBy >= 46 THEN 'Overdue by 46+ days' 
      WHEN OverdueBy >= 31 and OverdueBy <= 45 THEN 'Overdue by 31-45 days' 
      WHEN OverdueBy >= 15 and OverdueBy <= 30 THEN 'Overdue by 15-30 days' 
      WHEN OverdueBy >= 8 and OverdueBy <= 14 THEN 'Overdue by 8-14 days' 
      WHEN OverdueBy >= 1 and OverdueBy <= 7 THEN 'Overdue by 1-7 days' 
      WHEN OverdueBy <= 0 and OverdueBy >= -7 THEN 'Due in 0-7 days' 
      WHEN OverdueBy <= -8 and OverdueBy >= -14 THEN 'Due in 8-14 days' 
      WHEN OverdueBy <= -15 and OverdueBy >= -30 THEN 'Due in 15-30 days' 
      WHEN OverdueBy <= -31 and OverdueBy >= -45 THEN 'Due in 31-45 days' 
      WHEN OverdueBy <= -46 THEN 'Due in 46+ days' 

ELSE 'Less than that' END 


ORDER BY MAX(Temp.[OverdueBy]) DESC; 

:

select APRef as 'Invoice #', Vendor, VendorName, InvDate, Description, (DATEDIFF(day,DueDate,GETDATE())) as OverdueBy, SUM(Amount) as Amount from brvAPAllInvoices 
Where APCo = 1 and PaidDate is null 
Group By APRef, Vendor, VendorName, InvDate, Description, DueDate 

:

+-----------------------+--------------+ 
|  OverdueRange  | OverdueCount | 
+-----------------------+--------------+ 
| Overdue by 46+ days |   50 | 
| Overdue by 31-45 days |   15 | 
| Overdue by 15-30 days |   24 | 
| Overdue by 8-14 days |   121 | 
| Overdue by 1-7 days |   17 | 
| Due in 0-7 days  |   17 | 
| Due in 8-14 days  |   4 | 
| Due in 15-30 days  |   368 | 
| Due in 31-45 days  |   1 | 
| Due in 46+ days  |   14 | 
+-----------------------+--------------+ 

소위원회 보고서는 다음과 같은 쿼리를 사용

내 부모 보고서는 차트에 대해 다음 쿼리를 사용 하위 보고서 표는 다음과 같습니다.

+--------------+--------+-----------------------------------------------------------+---------------------+--------------------------------+-----------+-----------+ 
| Invoice # | Vendor |      VendorName       |  InvDate  |   Description   | OverdueBy | Amount | 
+--------------+--------+-----------------------------------------------------------+---------------------+--------------------------------+-----------+-----------+ 
|  00000418 | 3293 | Seaforth Civil Pty Ltd         | 2014-04-24 00:00:00 | Plant Hire, Materials, Repairs |  10 | 236602.94 | 
|  00001113 | 3377 | 3D Engineering Services Pty Ltd       | 2014-05-31 00:00:00 | Manufacture Handrails   |  -20 | 10236.60 | 
|  00001701 | 3273 | ADE Electrical Pty Ltd         | 2014-05-21 00:00:00 | Test & Tag 15m, 3 phase lead |   6 | 22.00  | 
|  00001921 | 2155 | Electrical Refrigeration Enterprises      | 2014-05-09 00:00:00 | Repair sensors and Lights  |  18 | 444.40 | 
|  00001932 | 2155 | Electrical Refrigeration Enterprises      | 2014-05-09 00:00:00 | Relocated button Security Door |  18 | 104.50 | 
|  00021458 | 1946 | VacUDigga Pty Ltd           | 2014-04-15 00:00:00 | Vac Excavation 11/4/14   |  10 | 1729.75 | 
|  00021869 | 1946 | VacUDigga Pty Ltd           | 2014-05-12 00:00:00 | Vacuum Excavation 12/5/14  |  -20 | 1694.00 | 
|  0003091 | 2677 | Parker's Liquid Waste Pty Ltd T/As Parker's Liquid Waste | 2014-05-06 00:00:00 | Pump out holding tank   |  -20 | 267.30 | 
| 003000775835 | 685 | ADT WSale Tools P/L T/As Glenfords Tool Centre Gladstone | 2014-05-13 00:00:00 | 9" End Nippers     |  -20 | 116.00 | 
| 003000776496 | 685 | ADT WSale Tools P/L T/As Glenfords Tool Centre Gladstone | 2014-05-28 00:00:00 | Air Tool      |  -20 | 19.00  | 
|  00980812 | 590 | Followmont Transport          | 2014-05-27 00:00:00 | Transportation     |  -16 | 441.54 | 
|  104760 | 2816 | Tank Services P/L T/As The Tasman Tank Co     | 2013-02-13 00:00:00 | Fit Ext Nut Caps to Tank 2  |  475 | 2141.93 | 
|  107776 | 3385 | GoTurf             | 2014-05-08 00:00:00 | TURF       |  -20 | 25942.40 | 
|  119023 | 808 | The Hose Shed            | 2014-05-05 00:00:00 | Flange and Plugs    |  -20 | 522.80 | 
+--------------+--------+-----------------------------------------------------------+---------------------+--------------------------------+-----------+-----------+ 

이 작업을 수행하기 위해 데이터를 어떻게 링크합니까?

답변

1

하위 보고서에 매개 변수를 추가하고 상위에서 매개 변수를 전달해야합니다.

관련 문제