A
Axess08
I am trying to create a query (query 2) that I will later use in a report. I
have 2 queries that are for used in my question. The idea is that I want to
group values by both State and by Year (in the end in a report) and average
the values that fall under a specific state and year. The averaging is of
course easy, but the grouping is not.
The 1st st query has a number of datediff and year calculations that will be
used in a number of other queries (i.e. Time to Arrival, FY2006, etc.), but
for the purpose of this question it will be used just for the 2nd query. The
1st query has the following calculation headings that will be referenced in
the 2nd query:
Time to Arrival (hrs) (Date diff function)
Time to Cooling (hrs) (Date diff function)
Age when MRI Done (days) (Date diff function)
FY2006 (which is an IIF statement that displays 1 if DOB is within the range
of the fiscal year, i.e. FY2006: Abs(([DOB]>#6/30/2005#) And
([DOB]<#7/1/2006#)) )
FY2007 (Similar IIF statement as above, but different range of dates)
FY2008 (Similar IIF statement as above, but different range of dates)
Current Qtr 1 (Similar IIF statement as above, but different range of dates)
Total (Similar IIF statement as above, but total range of dates)
Query 2 has a number of headings that have values that will later be
averaged and should be "grouped by" year and "Hospital State".
Time to Arrival
Time to Cooling
Fiscal Year (will not be averaged, but will be part of the group by)
Referring Hospital State (will not be averaged, but will be part of the
group by)
I would like to use the following calculation that references Query 1 and
basically puts a specific year value for whichever value is true:
Fiscal Year: IIf([TimingCalc]![FY2006]=1,"FY2006",Null) Or
IIf([TimingCalc]![FY2007]=1,"FY2007",Null) Or
IIf([TimingCalc]![FY2008]=1,"FY2008",Null)
Unfortunately, it does not work. It will only output a -1 ("true") value for
each of these. It could be that I shouldn't be using an IIf statement, but I
can't think of what would work better. I can't group the query by fiscal year
if I can't get the darn calculation to work. Anyone have any suggestions
(besides creating a seperate table for this - which there are too many DOB
values to manually type in seperate Fiscal years that correspond in a
seperate table)?
have 2 queries that are for used in my question. The idea is that I want to
group values by both State and by Year (in the end in a report) and average
the values that fall under a specific state and year. The averaging is of
course easy, but the grouping is not.
The 1st st query has a number of datediff and year calculations that will be
used in a number of other queries (i.e. Time to Arrival, FY2006, etc.), but
for the purpose of this question it will be used just for the 2nd query. The
1st query has the following calculation headings that will be referenced in
the 2nd query:
Time to Arrival (hrs) (Date diff function)
Time to Cooling (hrs) (Date diff function)
Age when MRI Done (days) (Date diff function)
FY2006 (which is an IIF statement that displays 1 if DOB is within the range
of the fiscal year, i.e. FY2006: Abs(([DOB]>#6/30/2005#) And
([DOB]<#7/1/2006#)) )
FY2007 (Similar IIF statement as above, but different range of dates)
FY2008 (Similar IIF statement as above, but different range of dates)
Current Qtr 1 (Similar IIF statement as above, but different range of dates)
Total (Similar IIF statement as above, but total range of dates)
Query 2 has a number of headings that have values that will later be
averaged and should be "grouped by" year and "Hospital State".
Time to Arrival
Time to Cooling
Fiscal Year (will not be averaged, but will be part of the group by)
Referring Hospital State (will not be averaged, but will be part of the
group by)
I would like to use the following calculation that references Query 1 and
basically puts a specific year value for whichever value is true:
Fiscal Year: IIf([TimingCalc]![FY2006]=1,"FY2006",Null) Or
IIf([TimingCalc]![FY2007]=1,"FY2007",Null) Or
IIf([TimingCalc]![FY2008]=1,"FY2008",Null)
Unfortunately, it does not work. It will only output a -1 ("true") value for
each of these. It could be that I shouldn't be using an IIf statement, but I
can't think of what would work better. I can't group the query by fiscal year
if I can't get the darn calculation to work. Anyone have any suggestions
(besides creating a seperate table for this - which there are too many DOB
values to manually type in seperate Fiscal years that correspond in a
seperate table)?