Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 19th, 2003, 11:06 PM
fnhaw fnhaw is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Australia
Posts: 5 fnhaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 0
Question Calculated total in PivotTable

Question from an Access newbie:
How are calculated totals used in queries and PivotTables? For example, how is the correct standard deviation determined in a PivotTalbe where many cells are empty? Say a PivotTable’s field has 10 rows but data occur in only 3 of the 10 rows; say the data are 5, 5 and 5. Using the built in AutoCalc function (StDev) will give the (wrong) answer 0 because only the 3 entries have been used rather than all 10 (the other 7, which I guess are absent or Null need to be taken into account and treated as zero). Any help with this would be fantastic.
Cheers

Reply With Quote
  #2  
Old July 20th, 2003, 07:33 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
How are you determing that the standard deviation is erroneous? Have you applied the formula to your data in question?

Reply With Quote
  #3  
Old July 20th, 2003, 08:08 PM
fnhaw fnhaw is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Australia
Posts: 5 fnhaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 0
The SD is correct given the way that Access calculates it; i.e. it has based the calculation on n=3, rather than n=10. In the PivotTable, there are many blank cells, because for any one field there isn't necessarily a value in all rows. However, to calculate the required SD, I need Access to treat the blanks in the table as zeros. So, in the example, if the field has three cells with the value '5' and seven cells with nothing (while another field may have 8 values and 2 blanks, and so on), I want Access to recognise that n=10 and not 3, treating the empty cells as zeros. This would produce the correct SD (2.4) and not the wrong SD of zero. I could do these calculations elsewhere, but I have several very large datasets (2-3 million points) and am trying to make the transition to Access, rather than keeping data in many text files that have a lot of redundant data.

Reply With Quote
  #4  
Old July 20th, 2003, 09:23 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Have you attempted to create default values of zero for these columns? If so, to what avail?

Reply With Quote
  #5  
Old July 20th, 2003, 09:50 PM
fnhaw fnhaw is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Australia
Posts: 5 fnhaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 0
No. I don't know how. But the problem seems so simple. To give a real example: in one subset of data, there are 50 replicates and about 200 variables. But, because not all variables occur in every replicate, the replicate (row) by variable (column) table (in Pivot view) will of course only have values in cells where the variable does occur in a replicate. But in calculating the SD or mean, I want Access to use the total number of replicates for n (in this case 50), not just the number of replicates where the variable occurs, in which case the mean, for example, would be based on an n that could vary from 1 to 50.

Reply With Quote
  #6  
Old July 20th, 2003, 09:58 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Is the issue with the data being returned from the query/database or with the lack of data being inserted into the database?

Reply With Quote
  #7  
Old July 20th, 2003, 10:19 PM
fnhaw fnhaw is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Australia
Posts: 5 fnhaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 0
Neither. Both the query runs as it should and the database is fine. The issue is with creating a calculated total that produces the correct means and standard deviations for each variable.

Reply With Quote
  #8  
Old July 21st, 2003, 08:36 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
If the query is running fine, then if ten rows are chosing and seven are null, those should be defaulted to zero. Thus there would still be ten items in the resultset. Ten items would be passed to the standard deviation formula and n should equal ten.

Reply With Quote
  #9  
Old July 21st, 2003, 09:01 AM
MattR MattR is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: High above the mucky-muck (Columbus, OH)
Posts: 266 MattR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to MattR
isnull( yourColumn, 0 ). Or it may be ifnull, can't remember in access.

Reply With Quote
  #10  
Old July 23rd, 2003, 01:10 AM
fnhaw fnhaw is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Australia
Posts: 5 fnhaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 0
The query just counts the number of occurences for the variables and the PivotView shows counts by field for each replicate. In using Create Calculated Total only those cells with values are used in the calculation, which is not what I want. So how does one ensure that the empty cells default to zero? It looks like this could be a VBA problem or maybe a more involved SQL statement than can be produced using query Design View. Frustrating, because I was hoping Access would make life a little easier.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Calculated total in PivotTable


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway