Results 1 to 8 of 8
  1. #1
    g4tv4life is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    50

    Turning True/False/N-A into percentages for access chart

    Hey guys,
    I am trying to use built in access charting create a simple line graph but I need help formating the data the way I need it.
    Right now I have a query that boils down the information into 12 records, one for each month of the year as a yes/no/N-a
    format (1 for true, 0 for false, 2 for NA). Now I want to chart the line as a simple average for the year (I.E. January is a yes,


    100% then February is a no, drops down to 50%, etc). Lastly, I want it to just use last months average if its a N/A and not
    have that month factor into the average.

    Any idea's how I can possibly do this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    I suppose you will need to do calculation in query to convert the Yes/No/NA.

    What do you mean by 'average for the year' - don't you want to plot 12 months?

    Nulls are ignored in aggregate calcs. What do you mean by 'use last months average' if its a N/A? Why would you want to carry one month's data to another month?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    g4tv4life is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    50
    by average for the year, I meant just a average OVER the year.

    As for use last months average, I meant I didn't want the N/A (which can be a null if it makes it easier) to affect the average.

    I'm not sure how exactly I can calculate a percent average over the year by a calculated field as I've never worked with them,
    Could you suggest how I could go about that?

  4. #4
    drexasaurus's Avatar
    drexasaurus is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Santa Ana, CA
    Posts
    60
    Like June said, Nulls are ignored, so if you don't want the value being counted or summed to affect the value, make sure the NAs are converted to null. If you did, you would have to convert them to zeros or some other representative value. If you are just getting the averages of the numbers 1 and 0 then you would use an aggregate function over that column. If you are using a report you could also use a function at the end--but you say you are using a built-in chart. I am better at this with T-SQL than with access SQL, but I know you can also do something like AVG(Iif([SomeValue]=2, Null, [SomeValue]) -- replace Null with 0 if you did want it to count.

    It also seems you might be looking for a running average? Like the entire average up to that point each month? That's more complicated, but if so you would have to create some complicated report that produced a running average for each month column. I'm not even going to think on dwelling on that one unless I know that's what you need and have a tested solution.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    How do you get the query that generates the 0/1/2 values? Why not 50/100/Null instead?

    Otherwise, maybe like:

    SELECT *, Choose([fieldname], 50, 100, Null) AS Percentage FROM table or query name;

    Then use that query as source for subsequent queries.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    g4tv4life is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    50
    Let me breakdown my entire system as it stands so far. I have 80 facilities, each with either a yes/no or N/A(which I've changed to now be null)for each month.
    These values are put into a table with both the date of the test, the facility and the response. The query breaks it down to a year range and facility based on
    what facility is selected in a form.
    drexasaurus, you are correct I need a running average, that's the term that was escaping me and where the complexity of this sits.
    Also, sadly this has to be a form because some minor edits in the data will be made.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    g4tv4life is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    50
    I spent a few hours toying with the code and realized it just wasn't in the cards. I've swappedto doing it through access automation through excel charting.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. True And False
    By azhar2006 in forum Forms
    Replies: 4
    Last Post: 12-23-2013, 03:50 AM
  2. Currency fields and if to get true/false
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 09-29-2013, 07:40 PM
  3. Replies: 7
    Last Post: 01-11-2012, 12:24 PM
  4. Yes/No True/False
    By DSTR3 in forum Access
    Replies: 5
    Last Post: 12-04-2010, 05:56 PM
  5. True or false
    By tleec in forum Queries
    Replies: 1
    Last Post: 02-01-2008, 10:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums