Avg for querry

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]
 
D

Duane Hookom

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.
 
L

lmossolle

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]
 
D

Duane Hookom

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Query Help 3
Statement Help 7
Drag and Drop does not work Outlook for Mac 0
Prior 3 Mo Avg Function 1
Statement 1
Avg query 5
Smoothing Data in Columsns in Excel 2012 1
Select Top with aggregate function 1

Top