Good afternoon, I have the following Query and ideally I'd like to be able to incorporate a further column whereby I was able to determine the Financial/Fiscal Year, i.e. April-March. Currently this has involved exporting to Excel (2010) and using a rather convoluted formula, which will only get more complex with the passing of time, to do this:
qry_Seen_Months_2019_10_08
Many thanks,
D€$
=IF(ISBLANK('2WW'!$A4),"",
IF(OR(
AND(YEAR('2WW'!$A4)=2017,MONTH('2WW'!$A4)>3),
AND(YEAR('2WW'!$A4)=2018,MONTH('2WW'!$A4)<4)),"2017-18",
IF(OR(
AND(YEAR('2WW'!$A4)=2018,MONTH('2WW'!$A4)>3),
AND(YEAR('2WW'!$A4)=2019,MONTH('2WW'!$A4)<4)),"2018-19",
IF(OR(
AND(YEAR('2WW'!$A4)=2019,MONTH('2WW'!$A4)>3),
AND(YEAR('2WW'!$A4)=2020,MONTH('2WW'!$A4)<4)),"2019-20",
""))))
qry_Seen_Months_2019_10_08
Code:
SELECT dbo_tblMAIN_REFERRALS.N2_9_FIRST_SEEN_DATE AS FirstAppt
, IIf(IsNull([N2_9_FIRST_SEEN_DATE]),fNoApptReason([dbo_tblMAIN_REFERRALS]![L_NO_APP]),[N2_9_FIRST_SEEN_DATE]-[N2_6_RECEIPT_DATE]-[N2_14_ADJ_TIME]) AS [1st Wait]
FROM (dbo_tblMAIN_REFERRALS LEFT JOIN dbo_tblDEFINITIVE_TREATMENT ON dbo_tblMAIN_REFERRALS.CARE_ID = dbo_tblDEFINITIVE_TREATMENT.CARE_ID) INNER JOIN dbo_tblDEMOGRAPHICS ON dbo_tblMAIN_REFERRALS.PATIENT_ID = dbo_tblDEMOGRAPHICS.PATIENT_ID
WHERE (((dbo_tblMAIN_REFERRALS.N2_9_FIRST_SEEN_DATE) Between #4/1/2017# And #10/31/2019#) AND ((dbo_tblMAIN_REFERRALS.N2_4_PRIORITY_TYPE)="03"))
ORDER BY dbo_tblMAIN_REFERRALS.N2_9_FIRST_SEEN_DATE;
Many thanks,
D€$