My Assistant
![]() ![]() |
|
|
Jan 30 2010, 06:37 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 69 From: Chicago, IL |
Alright. I'm running a query with some columns that return a value base on whether a field is null.
CODE ATTAINED: IIf((IsNull([Actuals.PROJ_ACT_ID]) Or ([Actuals.ACT_PERC_COM]<=[Baseline.ACT_PERC_COM])),0,1) So this either has a 0 or a 1 based on the condition. So in another query I did a simple SUM grouping on this column and it returns 22264. But if I pull the column into a spreadsheet, the number adds up to 92. What gives? |
|
|
|
Jan 30 2010, 07:10 PM
Post
#2
|
|
|
UA Admin Posts: 19,247 From: Newcastle, WA |
You have indicated that there is a discrepency (and a huge one at that), but re-reading through the description of the problem, I am still not sure which value you believe to be correct.
How many records are returned altogether? How many records inthat recordset have a value of 1 in the Attained column? Is it 92? or is it 22264? |
|
|
|
Jan 30 2010, 07:20 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 69 From: Chicago, IL |
There are 195 total records and 92 of them return a value of 1. Thus, the sum should be 92.
|
|
|
|
Jan 30 2010, 07:42 PM
Post
#4
|
|
|
UA Admin Posts: 19,247 From: Newcastle, WA |
And since we haven't seen the full SQL of either query, I'm going to have to guess that it is something like this:
Select Sum([Attained]) as TotalAttained FROM Query1 This assumes that the field [Attained] is in Query1 and that it contains the expression described in your first post? Is that accurate? |
|
|
|
Jan 31 2010, 12:45 AM
Post
#5
|
|
|
Retired Moderator Posts: 19,667 |
Try:
CODE ATTAINED: ((IsNull([Actuals.PROJ_ACT_ID])) Or ([Actuals.ACT_PERC_COM]<=[Baseline.ACT_PERC_COM])) + 1
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 24th May 2013 - 08:09 AM |