So I have a chart which I am hoping to drilldown into to provide the details. Both report SQL's are identical barring the (@PARAMETERS) in the where clause of the detail report.
Category Groups are FinYear, FinQuarter, WeekofYear
The SSL is as follows:
use HealthBI
;with cte as (
SELECT
p.PASID AS [HEYNo],
pr.REFERRALCREATEDDTTM AS [CreatedDate], -- Date & Time when the referral was created
d.DateValue,
d.StartOfWeek,
d.StartOfWeek_dt,
d.WeekOfYear,
d.FinQuarter,
d.FinYear,
ISNULL(u.FORENAME,'') + ' ' + ISNULL(u.SURNAME,'') [CreatedBy],
r.DESCRIPTION as [Staff Role],
Case when r.DESCRIPTION IN ('Clerical Access Role','Clerical Worker','Health Care Support Worker',
'Health Records Manager Access Role','Healthcare Student Access Role',
'Medical Secretary','Medical Secretary Access Role','Officer','Secretary',
'Support Time Recovery Worker') then 'Y' Else 'N' END AS [Clerical Entry],
tPRRTTCODE.TERMTEXT AS ReferToType,
pr.REFERRALREASON AS ReferralReason,
tPRESRCODE.TERMTEXT AS ReferralSource,
tPRFSTCODE.TERMTEXT AS ReferralStatus,
rsd.NAME ServiceDefinitionName
FROM LZO_PATIENTREFERRAL as pr
LEFT JOIN LZO_PATIENTREFERRALPROVIDER as prp ON pr.OID = prp.PATIENTREFERRALOID
AND prp.IDENTIFYINGTYPE = 'CC_RFREFSER'
AND prp.[STATUS] = 'A'
LEFT JOIN LZO_REFERRALSERVICEDEFINITION as rsd ON prp.IDENTIFYINGOID = rsd.OID
AND rsd.[STATUS] = 'A'
LEFT JOIN LZO_REFERRALSERVICEPROVIDER as rsp ON rsd.OID = rsp.REFERRALSERVICEDEFINITIONOID
AND rsd.[STATUS] = 'A'
LEFT JOIN LZO_PATIENT as p ON pr.PATIENTOID = p.OID
LEFT JOIN LZO_USERS as u ON pr.CREATEDBY = u.OID
LEFT JOIN LZO_CONCEPTCODE as ccOCCUPCODE ON u.OCCUPCODE = ccOCCUPCODE.CONCEPTCODE
LEFT JOIN LZO_TERM as tOCCUPCODE ON ccOCCUPCODE.OID = tOCCUPCODE.CONCEPTCODEOID
AND tOCCUPCODE.TRMTPCODE = 'Display_Text'
AND tOCCUPCODE.STATUS = 'A'
LEFT JOIN LZO_USERROLEPROFILE AS URP ON URP.USERSOID = u.OID
AND URP.STATUS = 'A'
LEFT JOIN LZO_ROLEPROFILE AS RP ON URP.ROLEPROFILEOID = RP.OID
AND RP.STATUS = 'A'
and (RP.PROFILEDESCRIPTION Like '%HULL AND EAST YORKSHIRE HOSPITALS NHS TRUST'
or RP.PROFILEDESCRIPTION Like '5%')
INNER JOIN LZO_ROLEPROFILEENTERPRISEOBJECT as eo on eo.ROLEPROFILEOID = RP.OID
and eo.IDENTIFYINGTYPE = 'ROLE'
and eo.STATUS ='A'
LEFT JOIN LZO_ROLE as r on eo.IDENTIFYINGOID = r.OID
LEFT JOIN LZO_CONCEPTCODE as ccPRESRCODE ON pr.PRESRCODE = ccPRESRCODE.CONCEPTCODE
LEFT JOIN LZO_TERM as tPRESRCODE ON ccPRESRCODE.OID = tPRESRCODE.CONCEPTCODEOID
AND tPRESRCODE.TRMTPCODE = 'Display_Text'
AND tPRESRCODE.STATUS = 'A'
LEFT JOIN LZO_CONCEPTCODE as PREADCODE ON pr.PREADCODE = PREADCODE.CONCEPTCODE
LEFT JOIN LZO_TERM as tPREADCODE ON PREADCODE.OID = tPREADCODE.CONCEPTCODEOID
AND tPREADCODE.TRMTPCODE = 'Display_Text'
AND tPREADCODE.STATUS = 'A'
LEFT JOIN LZO_CONCEPTCODE as ccPRFSTCODE ON pr.PRFSTCODE = ccPRFSTCODE.CONCEPTCODE
LEFT JOIN LZO_TERM as tPRFSTCODE ON ccPRFSTCODE.OID = tPRFSTCODE.CONCEPTCODEOID
AND tPRFSTCODE.TRMTPCODE = 'Display_Text'
AND tPRFSTCODE.STATUS = 'A'
LEFT JOIN LZO_CONCEPTCODE as ccPRRTTCODE ON pr.PRRTTCODE = ccPRRTTCODE.CONCEPTCODE
LEFT JOIN LZO_TERM as tPRRTTCODE ON ccPRRTTCODE.OID = tPRRTTCODE.CONCEPTCODEOID
AND tPRRTTCODE.TRMTPCODE = 'Display_Text'
AND tPRRTTCODE.STATUS = 'A'
LEFT JOIN HealthBI_Views.dbo.DATE_REFERENCE AS d on cast (pr.REFERRALCREATEDDTTM as DATE) = d.DateValue
WHERE pr.REFERRALREASON is not null and
pr.CREATEDAT > '9 July 2016'
AND pr.STATUS <> 'D'
and
(Case when r.DESCRIPTION IN ('Clerical Access Role','Clerical Worker','Health Care Support Worker',
'Health Records Manager Access Role','Healthcare Student Access Role',
'Medical Secretary','Medical Secretary Access Role','Officer','Secretary',
'Support Time Recovery Worker') then 1 end) = 1
or
pr.REFERRALREASON is not null and
pr.CREATEDAT > '9 July 2016'
AND pr.STATUS <> 'D'
AND tPRRTTCODE.TERMTEXT <> 'Referral service'
)
Select * From cte
order by cte.CreatedDate desc
The series Properties for the line graphs and the numbers I need to drill down on are:
=Sum(IIF(Fields!Clerical_Entry.Value="Y",1,0))
=Sum(IIF(Fields!Clerical_Entry.Value="N",1,0))
What I can't seen to manage is drill down based on those numbers. I know I'm close but just missing simonething, any suggestions more than welcome.