#### Query Criteria 04-15-10

```Hi,

Some of the fields I have in a table which is imported from a csv file are:
Salesperson (has up to 20 names in it)
Status (has Won,Lost,Submitted,Prospect,Did Not Proceed,Estimation)
Status Date (has date)
Value (\$ value)

What I am getting stuck on is a query to get the total value per Salesman
for each status and also the count of each status, I would like it to show
in datasheet form something like below.

Salesman      \$won            No. Won        \$lost                No.Lost
A                    \$100000        5                    \$150000        3
B                    \$75000            2                    \$10000        1
C                    \$150000        4                    \$0
0
and so on.

I have been able to get so far with a crosstab query, however I can not get
it to count for each status, it just gives me a total count by salesman,
also I can't work out where to put in a date criteria.

TRANSFORM Sum(tblResults.[Total Value]) AS [SumOfTotal Value]
SELECT tblResults.Salesperson, Sum(tblResults.[Total Value]) AS [Total Of
Total Value], Count(tblResults.Status) AS NoOfJobs
FROM tblResults
GROUP BY tblResults.Salesperson
PIVOT tblResults.Status;

Any help in getting started on this would be appreciated.

Neil

```
 0
Neil
4/15/2010 6:13:57 AM
access 16762 articles. 2 followers.

1 Replies
751 Views

Similar Articles

[PageSpeed] 23

```Never mind, I have worked out a solution, just need to add a few fields to
the first query.
for example:
won:iff([Status]="Won",1,0)
wonvalue:iif([Status]="Won","[Total Value],0)
won:iff([Status]="Lost",1,0)
wonvalue:iif([Status]="Lost","[Total Value],0)

etc
etc

Should look for the simple method  before jumping in.

Neil

news:D86CEE5E-8B02-47B0-8D86-2B2E786F6D62@microsoft.com...
> Hi,
>
> Some of the fields I have in a table which is imported from a csv file
> are:
> Salesperson (has up to 20 names in it)
> Status (has Won,Lost,Submitted,Prospect,Did Not Proceed,Estimation)
> Status Date (has date)
> Value (\$ value)
>
> What I am getting stuck on is a query to get the total value per Salesman
> for each status and also the count of each status, I would like it to show
> in datasheet form something like below.
>
> Salesman      \$won            No. Won        \$lost                No.Lost
> A                    \$100000        5                    \$150000        3
> B                    \$75000            2                    \$10000
> 1
> C                    \$150000        4                    \$0 0
> and so on.
>
> I have been able to get so far with a crosstab query, however I can not
> get it to count for each status, it just gives me a total count by
> salesman, also I can't work out where to put in a date criteria.
>
> TRANSFORM Sum(tblResults.[Total Value]) AS [SumOfTotal Value]
> SELECT tblResults.Salesperson, Sum(tblResults.[Total Value]) AS [Total Of
> Total Value], Count(tblResults.Status) AS NoOfJobs
> FROM tblResults
> GROUP BY tblResults.Salesperson
> PIVOT tblResults.Status;
>
>
> Any help in getting started on this would be appreciated.
>
> Neil

```
 0
Neil
4/15/2010 8:08:43 AM

Similar Artilces:

Timer for Queries?
Does anyone know of a macro or add-on that I could use as a simple timer for queries? I don't like to use the CPU time in the Task Manager because of it's inaccuracy when not receiving full CPU usage. THanks for any suggestions -- cmungs Exactly what are you trying to accomplish? Are you trying to cause a query to run automatically every so often? If so, you will need to use the timer event on a form to do that. -- Lynn Trapp Microsoft MVP (Access) www.ltcomputerdesigns.com "cmungs" <cmungs@discussions.microsoft.com> wrote in message news:88EC7019-045F-4EF...

Erratic results from query criteria
I am getting different results from running the same query with the same selections. One moment it is all behaving as expected, the next it has gone haywire. (I have done what appears to me to be EXACTLY what I have done in another database, where it works perfectly every single time.) In a query I have, amongst others, the following fields: Category SubCategory Company I want to be able to select any OR ALL of the relevant fields. I have the following criteria: Like "*"&[Type Category otherwise leave blank for ALL]&"*" Like "*"&a...

Question 10-10-03
How can I designate the firt row on a Excell Sheet to stay at the top of the document while I scroll up and down the document? Thanks ...

Outlook Express 04-19-10
Outlook Express is placing an inbound email directly into the Deleted Items folder, but only email from a specific sender, it is not going into a spam folder, this is the Outlook Express version that shipped with Microsoft Office 2003. Can anyone help? Outlook Express does not ship with an Office program. It is not related to Office. This is an Outlook newsgroup. You should ask in an Outlook Express newsgroup. "Pam" <Pam@discussions.microsoft.com> wrote in message news:BD71DF0C-ACBB-42BA-8336-4FD3ACC49BD9@microsoft.com... : Outlook Express is placing an inbo...

Update Query ?
Is there a way to 1) Assign events when adding in data thru an update query for example if you append a bunch of data into a table could you then do some kind of an update query to say if there is an initial event and no others tag this one Renewal 1 etc.. the only real data you have to go on would be Customer A and the total amt .. the event, renewal event and the delta would all need to be added in example: Say Customer A comes in with an initial deal then Customer A renews their deal So, the data would look like when you're done.: Year Custo...

We're in the QA phase of an upgrade to Dynamics GP V10 from V8SP5 and we've encountered a problem with the Home Page. If the Outlook section is visible, Dynamics GP will crash during the rendering of the Home Page with an error referencing dxtrans.dll. I have checked versions of this dll with a known to be working workstation and found no differences. I suspect there is an issue with way IE is configured (or operates) in Server 2003. For now we've removed the Outlook section of the Home Page and are proceeding with our QA testing. This question was originally posted by ...

design query match anywhere?
In the design query I want to match the letters "ABC" anywhere in the column 'description'. I could not get instr to work by using: InStr(description, "ABC")) > 0 How else can I match ABC (upper and lowercase) to anywhere in my 'description' column? Thanks! Are you saying you put that InStr bit as a criteria under your Description field in the query designer? Try putting Like "*ABC*" as the criteria instead. Alternatively, you could add a computed field to the query InStr([Description, "ABC") and then put >0 as the ...

Flash 10 OCX update causing System Error crash in vb6 IDE
Hi All Has anybody else experienced problems when using flash ocx controls in your VB6 app since the latest Adobe flash player update came out?? I **think** I was on v. 10e and everything was rosey, a little message appeared on PC startup saying do you want to update your flash player, clicked yes and then all my bloody vb6/flash apps stopped working!!! You can't save any changes to the code when a form has the flash ocx component in the form. It keeps crashing with a System Error. I'd kept the flash standalone installer for v10e, but couldn't even reinstall ...

Unexpected Error- Running Advance Find Query
I am getting a message that says "Unexpected Error An Error has occurred" when I am running an advanced find query on two custom entities. It seems to be when I have certain custom fields included in my view that the query errors out. Any help on this would be greatly appreciated. Thanks so much. Just wanted to add that I seem to get errors when there is a 0.00 amount in these fields... "TJ" wrote: > I am getting a message that says "Unexpected Error An Error has occurred" > when I am running an advanced find query on two custom entities. It se...

CRM Data Migration 11-03-04
Hi, I would like to enquire how long will I need to take to migrate data from a table in an access database to MS CRM? For instance I wana migrate 10 columns in customer table in access database to MSCRM. How much effort need to be done? As I have not done any data migration before. So wat do I need to do n prep myself in order to start the data migration for my customer? any guidelines to assist me? Kindly assist me pls. thanks Johnson Dear Johnson, You should take a look at the data migration framework. This is on a cd which is delivered with crm, or you can download it from t...

pass through query
If a combobox is populated by a pass-through query, does it requery every time the form is closed and reopened? Thanks, Sam Yes. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Sam wrote: > If a combobox is populated by a pass-through query, does it requery every > time the form is closed and reopened? > Thanks, > Sam ...

a count field in a query?
Hello, I have a query in which I would like to create a field which increments by 1 for each record selected, so if there are 10 records selected by the query, this column would show numbers 1 to 10. Ideally I would like to have some text in front of each number, say invoice1, invoice2 etc. From a previous posting I realise that this is frowned upon but it would be the simplest solution for my problem! How can I do this? Thanks Geoff On Mon, 03 Dec 2007 08:54:00 +0000, Geoff Cox <<>> wrote: >Hello, > >I have a query in which I would like to create a field which >...

Multiple criteria
Ok I have a workbook I am working on for someone else and my formulas will not work. Any help would greatly be appreciated. =SUMPRODUCT(--(C4:C59>=5900),--(C4:C59<=5999)) this works like a charm but I need to use this plus (e4:e59="g-shift"). I need the first formula to be the condition to count the second formula. so basically i want if c4 has 5950 and E4 has g-shift then I get 1 and if e4 is blank then i get 0. Everything I have tried says that the formula is wrong. Did you try: =SUMPRODUCT(--(C4:C59>=5900),--(C4:C59<=5999),--(e4:e59="g-shift")) I...

Saving Username and Pass with Web Queries
I am pulling data from a website that requires you to provide a usernam and password everytime you visit the site. Excel has cachin capabilities, but everytime you close excel and try and open up th spreadsheet again, it can't login. What is the fix for this? Thanks, Hend -- Message posted from http://www.ExcelForum.com Bump! --- Message posted from http://www.ExcelForum.com/ ...

Birthday query for many children in one record
I have a database for the church, it has one main flat table only. Each record for the parents have field for child1 name, child1birthday, child2 name, child2birthday, child3 name, child3birthday - up to 5 children. I am having difficulty trying to get a report to list the birthdays of the children like this parent name, child 1 name, child 1 birthday month etc. so you get something like this:- Parent John Smith, child Mary Smith January 3 Parent Fred Jones, child Bert Jones March 4 Parent John Smith, child Jane Smith March 6 Parent Harry Brown, child Jane Brown March 6 Parent Bert Taylor,...

SFO Error 08-27-04
Can anyone who has seen the message "The specified domain logon already exists. You must specify a unique domain login name or open the user record that is using this name already", please explain what causes this when going Offline in the SFO. Other than that, it's possible to get "you do not have permissions". Is there any way to resolve this, other than install SFO onto a client logged onto the CRM domain, as opposed to a trusted domain (of which such a trusted user is able to be used succesfully within CRM with automatic login in intranet zone, indicating it at le...

Unresponsive Query Wizard
Hi there, I have an Excel 2003 user who is using a spreadsheet that pulls data from our SQL server. When he opens it and refreshes the data it is fine, it pulls the current data, but when he tries to edit the query, the Query Wizard does not appear, he can see it on the task bar, but when he switches focus using task manager everything is greyed out and nothing works. I have tested the file from my computer and it is fine, which suggests a problem with his machine or installation. Does anyone have any ideas? Cheers, Steve Dooza wrote: > Hi there, > I have an Excel 2003 user who...

Another simple query
Dear all, I have a table that contains first names and last names in different fields. Is there any way to write a query that will give as a result the first name and last name in the same field? I hope this makes sense. Thanks in advance! SELECT [last_name_field] & ", " & [first_name_field] AS whole_name FROM [your_name_table] Change the field and table names to whatever your actual fields and tables are. Cheers, Jason Lepack On Apr 23, 9:47 am, Homer <peter.a.r...@googlemail.com> wrote: > Dear all, > > I have a table that contains first names an...

Query query
I am trying to create a new field in which it shows the sum total of 10 fields (Charge Time, Charge Time 2, Charge Time 3, etc.); what is the easiest way to do this? -- Joe NewFieldName: [Charge Time] + [Charge Time 2] + [Charge Time 3] .... etc -- Good Luck BS"D "joet5402" wrote: > I am trying to create a new field in which it shows the sum total of 10 > fields (Charge Time, Charge Time 2, Charge Time 3, etc.); what is the easiest > way to do this? > -- > Joe I tried this, and it doesn't work. Is there something I'm forgetting? -- Joe ...

Formula needed 01-22-10
Hi I need a formula that will look in one column range for a certain value and for another value in another column range and when they are both found in the same row, will count the number of occurances. Help!!!! Krissy wrote: > Hi > I need a formula that will look in one column range for a certain value and > for another value in another column range and when they are both found in the > same row, will count the number of occurances. Help!!!! http://www.contextures.com/xlFunctions01.html#SumProduct Omit the "values to be summed". =SUMPRODUCT(--(A2...

group by query trouble
I'm trying to run a query that counts the number of people with hemoglobin of type SS, type SC, and then all others. There are about 12 different kinds of types. Basically I want a count for SS, a count for SC, and then a count that totals all the others into one count. Hopefully that makes sense. I'm using group by for the SS and SC which works great, but I'm not sure how to tell it to add up the others. I'm not a big fan of nested IIf statements, but this should work after you put in the proper field and table names: SELECT IIf([Hemoglobin]="SC","SC&...

To Query or not to Query??
Hello all - I'm a newbe to Access but have made great progress. I'm using Acess 2003. The db is up and running prefectly. Now I need to tackle the reporting. I have seen posts about reports and queries and am a little confused. Do I need to create a query to run my reports off of? I have a tabbed subform in the main form. There are seven tabs breaking up all the services we provide. Like "Promo Items", "Leads", "Client Printed Material","Internal Print Material" and so on. The main form has the User, Branch and Marketing Rep. I need to...

Dynamic Query
Hi! I am trying to dynamically modify my pass-through query containing a procedure call with 2 parameters. When I run my access app, I get this error: "Object or provider is not capable of performing reuqested operation." Below is my access code: Dim varItem As Variant Dim strSQL As String Dim cat As ADOX.Catalog Dim cmd As ADODB.Command Dim strMyDate As String, dtMyDate As Date dtMyDate = CDate([Forms]![ySalesHistory]![Start Date]) strMyDate = Format(dtMyDate, "yyyymmdd") strSQL = "procCustomerSalesandPayments '" & s...

I have a database that contains information on a certain number of individuals during different session. Table 1 'tbl_Tracking_Form1' has information on sessions 2,4 and 6. Table 2 'tbl_Tracking_Form2' has information on sessions 1,3 and 5. Table 3 'tbl_General_Info' has demographic information on all the individuals (those who will eventually attentd sessions 1,2,3,5,5 and 6). I need to create two reports. One (Report1) should display all the information on the individuals during session 2, 4 and 6 and another(Report2) that displays all the information on the i...

Query in Access 2007
I have linked via ODBC tables from another database. I have created a query to pull in two columns of information from the two tables in the query. I would like to add an extra column that is only created when the query is run, to dynamically number each row incrementally, depending on how many rows the query returns. If it returns 10 rows, then the first column should be numbered 1 to 10, if it returns 357 rows, then the rows should automatically incrementally number each from from 1 to 357. Try this but substitute your table and field names. Prim is your primary key. This can o...