Avg for querry

  • Thread starter Thread starter lmossolle
  • Start date Start date
L

lmossolle

I am trying to use the following but keep getting errors. Could someone
please assist?

Avg(IIf(daystoaward/awarddays)) AS [Average # Days to Award]
 
I'm not sure what your field names are. However, IIf() require three
arguments:
- True/False expression
- result if true
- result if false
Your IIf() has only one argument and we don't know anything about your table
structure, data types, or what you are expecting to calculate.
 
Here is my whole Query;

Most data comes from a table, there are ony 2 querys used to get data. They
are Awarddays and daystoaward

SELECT
Table.Assigned,
Count(Table.[PR#]) AS [Cumulative Actions],
Sum(IIf(Status="returned",1,0)) AS [# Actions Returned],
Sum(IIf(Status="pending",1,0)) AS [# Actions Pending],
Sum(IIf(Status="solicited",1,0)) AS [# Actions Solicited],
Sum(IIf(Status="awarded",1,0)) AS [# Actions Awarded],
Sum(IIf(Type="Mod",1,0)) AS [# MOD Actions],
Sum(IIf(Award_Date>=Date_Rec,Award_Date-Date_Rec)) AS daystoaward,
Sum(Nz([PR_$_Value])) AS [$ Value], Sum(IIf(Complete="Yes",1,0)) AS Awarddays
FROM
Duane Hookom said:
I'm not sure what your field names are. However, IIf() require three
arguments:
- True/False expression
- result if true
- result if false
Your IIf() has only one argument and we don't know anything about your table
structure, data types, or what you are expecting to calculate.

--
Duane Hookom
Microsoft Access MVP


lmossolle said:
I am trying to use the following but keep getting errors. Could someone
please assist?

Avg(IIf(daystoaward/awarddays)) AS [Average # Days to Award]
 
Read my previous reply and then look at your expression:
IIf(Award_Date>=Date_Rec,Award_Date-Date_Rec)

--
Duane Hookom
Microsoft Access MVP


lmossolle said:
Here is my whole Query;

Most data comes from a table, there are ony 2 querys used to get data. They
are Awarddays and daystoaward

SELECT
Table.Assigned,
Count(Table.[PR#]) AS [Cumulative Actions],
Sum(IIf(Status="returned",1,0)) AS [# Actions Returned],
Sum(IIf(Status="pending",1,0)) AS [# Actions Pending],
Sum(IIf(Status="solicited",1,0)) AS [# Actions Solicited],
Sum(IIf(Status="awarded",1,0)) AS [# Actions Awarded],
Sum(IIf(Type="Mod",1,0)) AS [# MOD Actions],
Sum(IIf(Award_Date>=Date_Rec,Award_Date-Date_Rec)) AS daystoaward,
Sum(Nz([PR_$_Value])) AS [$ Value], Sum(IIf(Complete="Yes",1,0)) AS Awarddays
FROM
Duane Hookom said:
I'm not sure what your field names are. However, IIf() require three
arguments:
- True/False expression
- result if true
- result if false
Your IIf() has only one argument and we don't know anything about your table
structure, data types, or what you are expecting to calculate.

--
Duane Hookom
Microsoft Access MVP


lmossolle said:
I am trying to use the following but keep getting errors. Could someone
please assist?

Avg(IIf(daystoaward/awarddays)) AS [Average # Days to Award]
 
Back
Top