PC Review


Reply
Thread Tools Rate Thread

How to convert Null values to zero when create an average query

 
 
BB
Guest
Posts: n/a
 
      15th Apr 2010
This is my crosstab query

Items Worked April 2010 March 2010 Average

Reports 2 4
3
Tables 5
5
Files 2 2
2

As you can see, for "Tables" the query is giving me an average of "5"
instead "2.5" because is not counting the null value date. How can I fix
that? the SQL query so far is this:

TRANSFORM Avg([Integrate Query].Total) AS AvgOfTotal
SELECT [Integrate Query].[Items Worked], Avg([Integrate Query].Total) AS
[Total Of Total]
FROM [Integrate Query]
GROUP BY [Integrate Query].[Items Worked]
PIVOT [Integrate Query].[Date Worked By Month];

how can I change it?





 
Reply With Quote
 
 
 
 
Daryl S
Guest
Posts: n/a
 
      15th Apr 2010
BB -

Look at the nz function, which will replace a null with any value you want
(in this case zero):

nz([Integrate Query].Total,0)

--
Daryl S


"BB" wrote:

> This is my crosstab query
>
> Items Worked April 2010 March 2010 Average
>
> Reports 2 4
> 3
> Tables 5
> 5
> Files 2 2
> 2
>
> As you can see, for "Tables" the query is giving me an average of "5"
> instead "2.5" because is not counting the null value date. How can I fix
> that? the SQL query so far is this:
>
> TRANSFORM Avg([Integrate Query].Total) AS AvgOfTotal
> SELECT [Integrate Query].[Items Worked], Avg([Integrate Query].Total) AS
> [Total Of Total]
> FROM [Integrate Query]
> GROUP BY [Integrate Query].[Items Worked]
> PIVOT [Integrate Query].[Date Worked By Month];
>
> how can I change it?
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert Null values to zero when create an average query BB Microsoft Access Queries 1 15th Apr 2010 01:54 PM
Empty text values aren't null or zero-length, but 2-byte null (\x0000) Mark Steward Microsoft Access 2 21st Jan 2006 03:03 PM
Exclude null values in average of a column of values? =?Utf-8?B?TkNfU3Vl?= Microsoft Access Reports 5 6th Jan 2006 04:00 PM
Report shows null values, how to convert to a zero =?Utf-8?B?REJlbmVkaWN0?= Microsoft Access Reports 1 21st Dec 2005 04:43 AM
Query to convert zero lenght string to Null Kevin Farrell Microsoft Access Queries 1 24th Jul 2003 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:37 PM.