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

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?





0
Utf
4/15/2010 12:41:01 PM
access.queries 6343 articles. 1 followers. Follow

1 Replies
1653 Views

Similar Articles

[PageSpeed] 38

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?
> 
> 
> 
> 
> 
0
Utf
4/15/2010 1:36:01 PM
Reply:

Similar Artilces:

Creating a new field based on conditions
I have a database that tracks insurance information for our various vendors. Each insurance type has 2 fields - a requirement field (yes/no), and an effective field (some show an expiration date, some are yes/no). I have created a query that will return only the records for which insurance is required but is expired/missing. My problem is that I want to create a new field that is calculated based on the values in the other two fields in order to make the resulting report more user-friendly. For example, if GLRequired is True and GLExpiration is <Now(), I want the new field to say...

Creating array of specific object types dynamically
Hi, little gotcha. Some COM objects requires array of specific type. To give you example, following DOESN'T work: [array]$X = @() However below code works: [int32[]]$X = @() For my framework, array type can be dynamic and I don't know in advance what type it's going to be. So what I would need is below: [$PropertyType[]]$X = @() This doesn't work with error message "Unable to find type". As a workaround, I solved it using following: Invoke-Expression "[$$PropertyType[]]`$Var = @()" This code works as expected, I am just curious if ...

checkbox as query criteria
Hi, in an Access form i've put a combo box that has a query as data source. On this form I'd like to add a check box that, when it is selected, adds the "is not null" criteria on a query field. There is a simple way to do this? Thank you very much for help. -- Remigio www.sacraspina.it www.amicitosondoro.it www.icmonteodorisio.it www.parrocchiacupello.it www.cralnuovainiziativa.it www.associazionehistonium.it On Sat, 1 May 2010 05:55:14 -0700 (PDT), remigio <linoreale@gmail.com> wrote: Create two queries. Then switch between them based on your n...

converting tabular structures in a Word document into an actual table or reading data from the tabular structures using VBA code
I have a macro which can read the last cell/column of all tables in a Word 2003/2007 document and store the data in an MS-Access table. But, some Word documents have the data in structures like a table format but are not actually tables. The structure looks like a table, but the table borders are actually line connectors. These documents were created by a software(VeryPDF PDF to Word converter) which converted the PDF documents(the original format these documents were) into Word documents. 1. Is there a way I can convert/replace the tabular structures with actual tables in Word so t...

How do I convert a word table into an excel document?
I have managed to get the info accross no problem but the formatting is all over the place. For instance - 07/10 meaning July 2010 is appearing as 07/Oct despite me going into format cells custom then enter mm/yy which has always worked previously. Any ideas? You can't use it like that regardless of formatting, you need to put in the whole date or else Excel will always assume the current year so any real date used for calculations needs to be numeric and needs a day, so you can enter (assuming US date format) 07/01/10 and use a custom format of mm/yy or if you don't need it for...

Problems Converting Data from Quicken 2001 Deluxe to MS Money
Hello, I have a relatively new Compaq Desktop (2.5 GHz Celeron with 512 MB RAM). I have a Viewsonic Pocket PC and I wanted to use it to track my financial data so I purchased Money 2003 Standard. I tried several times to convert my Qucken Data (it's a big file--I've been using Quicken since 1995). My Quicken program is Quicken 2001 Deluxe. Anyway, the MS Money program started to convert and after a few minutes said: "Your Quicken file could not be converted. Money could not convert your Quicken file. You might have run out of disk space or system memory. Try closing othe...

Create static text from cell reference
Hey everyone... I have two columns of text which I'm combining in a third column using the formula (for C1, for example) =A1 & char(10) & B1 This gives me the contents of A1 on a line above the contents of B1 and works fine. What I NEED to do is somehow create column C as TEXT, not as a REFERENCED data from columns A and B. How do I create a cell that contains the actual TEXT content of another cell instead of a REFERENCE to the other cell? TIA... Select all the cells in "C" that have content. R-click them and select "Copy" then r-click again, sele...

automaticly create graph
what i would like to do is create a spread sheet where by i entered the fixed and variable costs as well as the selling price. i would then like a graph to automaicly change and display the this info. Does anyone know how to do this. Decide which cells on the spreadsheet you wish to include in the chart. Select those cells. Follow the menu option: Insert/ Chart, and answer the questions in the wizard. Have you looked in Excel help at the topics concerned with charts, starting with "Create a chart"? Have you looked at the training material under http://office.microsoft.com/...

Trying to create an Update query based on HR data to find upline V
Hi All, looking for some advice. I have an HR table that contains employee information but does not contain management chain info. Basically i am trying to determine who the employees upline VP is. The fields i have to work with are [Employee Name], [Manager Name] and [Job Title]. I figure the logic would be to check the employees' manager and if the manager is a VP (based on job title), return the manager's name to a field called [VP]. If the manager is not a VP then check that manager's manager, so on and so forth until a VP is found. Any ideas would be much appr...

Creating a Graph
hi all, i want to create a grapg dynamically getting the values from a file.. take for example the first row is the x axis and the second row is the y axis. i am planning to do this in mfc. what needs to be done for this.. if somebody has an example relating this please send me the link or the code.. thanks Read the data. Plot it. First, you have to read the data. You read the data and build an array of <x,y> pairs in whatever way you want to save them, e.g., int, float, double. This is pretty elementary programming. To do a graph in a very fancy way, you should use an existing gra...

"the wizard is unable to open your query in datasheet mode, possi
"the wizard is unable to open your query in datasheet mode, possibly because another user has a source table open in exclusive mode. your query will be opened in design view" what this message mean ,and how can i solve it Hi - Please provide more details as to what you are doing when you get the error, what your database setup is (i.e. split Fe/BE?, multiuser?, version? etc). Without more information, we can only guess. Thanks - John amr wrote: >"the wizard is unable to open your query in datasheet mode, possibly because >another user has a ...

Querying multiple records in two tables
Hi, in my database I have tables for users (UserID, UserName), projects (ProjectID, Project Name), and qualifications (QualID, QualName). I have join tables for users_qualifications (UserID, QualID), and projects_qualifications. (ProjectID, QualID). What I need to do is run a query for a project to show which users have the exact matching qualificiations. Users can have many qualifications, projects can require many qualifications, users may only work on a project if the qualifications required/held match exactly. Please help. Assuming that ProjID, and QualID are numeric, the following sho...

Can you create custom activities? MSCRM 3.0
Hi, Is there a way to create a new custom activity instead of customising an existing one? I have created a custom entity called 'Chat' utilising an IFRAME. All works well but this entity really should be an activity considering it's properties. In fact I've just been introduced to MS-CRM 3.0 and don't really understand what the difference is between an entity and activity. Would anyone shed the light for me? BTW, I think 3.0 looks great. Gotta admit it's improved. Cheers. Ty In my experience, you cannot create custom activities. In fact, I have been dire...

Not using zeros in graphing.
I have a running workbook that has tons of information. I have added a sum page in order to have all the data summed up in one simple place. I have formulas that read back into the workbook to link to a cell. Depending on what moth it is, that cell could be empty as it is a yearly wookbook. For example, if this is August, then there is information in the workbook up to August, but none after. With that said, the sum page has the #DIV/0! in the cell which essentially equals zero. I also have graphs that I have linked to this sum page. My problem is in order to keep the graphs up to...

Converting date from an external source
I am having an issued with converting a date from external data source. the data has the timestamp in the general date form mm/dd/yyyy 00:00:00. I want to convert the date to mm/dd/yyyy format so when i run a query for a single day it will return the data for that date, I can currently return the data but i have to set the parameter in the mm/dd/yyyy 00:00:00 format, i want to simply return the data by setting the parameter in the mm/dd/yyyy format Don't confuse how data is stored with how it is presented. As long as you import the date into a field defined as a Date data type, you...

Excel 2002 converts 'S' to 0 when pasting from Clipboard
I came across the following problem: I copied some tabular data from IBM Personal Communications into the clipboard (yes, I am still a user of good old 3270 applications). Then I pasted the data into Microsoft Excel 2002 and all cells containing a 'S' became a '0' (number zero). Next I did some tests and found out that every single uppercase 'S' that is transferred to Excel using copy/paste is translated to '0'. This would not happen with other letters or with words containing an 'S'. Using 'Paste special' I can choose to insert my Clipboard a...

Average of logic cells
I used a logic test to determine some levels from raw scores. For EG >120 =5, 119-110 = 4, etc. I now want to dtermine an average score of several of the the results from the logic tests but it doesnt seem to work. (AVG does not recognise cells with logic tests) Can anyone help, please? -- ckdkvk ------------------------------------------------------------------------ ckdkvk's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29245 View this thread: http://www.excelforum.com/showthread.php?threadid=489704 hi, ckdkvk ! > I used a logic test to determine so...

Can I do this query in one step?
Suppose I have a talble like this, each record has a unique ID. All"A"s or "B", "C"s should have only x or y or z property attached. Iwant to find A, B or C which has more than one properties.1 A x ...2 A x ...3 A x ...4 A y ...5 B x6 B y7 C z....resutls would look like:A xA y....I think I can do this in two steps or with a subquery. Then I thoughtof self-join but didn't figure out how to use it in this case.Thanks a lot! SELECT DISTINCT and do not include the record ID perhaps? Or is the record ID vital?"muster" <muster@gmail.com> wrote in me...

Sum amount if = 2 value's
I have a spreadsheet of payment types for which I want to sum the tota amount per type per month A B C Type Amount Month I'm able to get the total amount per type by usin =SUMIF(A:A,"TYPE",B:B), but can't work out how to get a total for eac type each month Somthing along these lines: =SUMIF((A:A,"TYPE",B:B)&C:C,"MONTH")) ???? Any idea's -- loscherlan ----------------------------------------------------------------------- loscherland's Profile: http://www.excelforum.com/member.ph...

Run series of query -- I don't want any pop-up
I have generated 4 queries (1. empty all, 2. import data, 3. generate information, 4. Make a new table) I've created a button to run these 4 quries sequencially. ------------------------------------------------------------------------------------ Problem: MS ACCESS pops up "confirmation dialog" to ask me whether to delete/modify the table. ------------------------------------------------------------------------------------ Question: I don't want any question to be asked. I just want those queries to be executed once i press my button. -------------------------------...

Compare each value in a range to each value in another range
I am looking for a macro that will return a comparison of each cell in a range to each cell in another range. example. the first range would have vales of 1,2,3 and the second range would have values of 5,6,7 Thus the macro should return 9 possible comparisons: 1 & 5, 1 & 6, 1 & 7, 2 & 5, 2 & 6, 2 & 7, 3 & 5, 3 & 6, 3 & 7, Can anybody help me with this?? Just hazarding some thoughts here .. Perhaps using formulas would suffice ? Example: Assume 1st range is A1:A3, 2nd range is B1:B3. Then Compare 1st range against 2nd range I...

Create a Loop for create a phone call
Hi Best Regards Excuse me for my bad english I am developing a workflow, which must create automatically phone calls and assign them to certain users of the following way: it must create the number of 10 calls and to assign them to user 1, to create 5 calls and to assign them to user 2 etc the data of the phone calls is in a database I am trying to create a loop but I have not found like I am thankful for your help regards You will need to do this using the CRM SDK/web service. Do something like : CrmService service = new CrmService(); // Setup the CrmService class here foreach (U...

Creating formulas to calculate time on a 24 hr time clock
I have to create a spreadsheet that will calculate total hrs worked. I've tried several different ways but I guess I don't know enough about building formulas to actually make the thing work. For example, I used a basic formula D3=A3-B3+IF(A3>B3,1)*12. This works to show the time but not the number of hours worked. If an employee comes in 1/2 hour late, it does not properly calculate this. How can I correct my formula? MW I have tried your formula and it works fine (with start time in B3 and finish time in A3). Format the reult as h:mm and it's OK. Andy "MWI...

using rule creates multiple entries. How can I stop this?
I'm going to give you the details of this so maybe someone can just tell me how to correct or whether it can be corrected. I've tried creating different rules, rules with exceptions, multiple rules with multiple exceptions, all I can think. Here is the scenario. Although I'm using Lisa as an example, this problem applies to every staffer in my 9 person office. Lisa is my secretary. She sends me internal email, staff questions and stuff which goes to a a "Staff" subfolder of the Inbox. I have a rule for this. She also sends me mail she has scanned. I ha...

How do I create synchronised lists in Excel?
I want to create synchronised validated lists in Excel so that, when I choose one item from the first list, I can only choose from a set items in the second list. If I choose a different item in the first list, I will only be able to choose from a different set of items in the second list. Is there a way to do this? I am using Excel 2007, with Windows XP. http://www.contextures.on.ca/xlDataVal02.html Gord Dibben MS Excel MVP On Mon, 22 Mar 2010 05:47:01 -0700, Kimtab <Kimtab@discussions.microsoft.com> wrote: >I want to create synchronised validated lists in Ex...