Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12

    Filter report based on SUM value in box

    Hello guys,

    Can you please help me with one problem, i'm bothering with it whole day... I have a report based query tblData, each person have more than 1 project and in the end i SUM value in box SUM(porabljen_čas) that mean used_time in english, so what i need to see is, when i open the REPORT i want to see only records/rows where a person didn't complieted 100% (less or more), every record with value different than 100%.

    Here is the pic:



    Kind regards, Saso

  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,625
    Yes, can filter on calculated field. Put on the criteria row under that field: <> 100
    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
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    Hello,


    It writes me:

    Cannot have aggregate function in WHERE clause <clause>. (Error 3096)


    You cannot use an aggregate function in the WHERE clause of an SQL statement. Is it any other option?

    Kind regards, Saso

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Should be HAVING clause. Did you use design grid of query builder? Works for me.
    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.

  5. #5
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12


    I have like this and it's not working :/

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    What language is that? What does Vsota mean?
    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.

  7. #7
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    Vsota means SUM, that's Slovenian languege I'm sorry for that...

    And that is SQL code:

    SELECT tblPodatki.podatkiID, tblPodatki.Oddelek, tblPodatki.[Ime in priimekID], tblPodatki.AktivnostID, tblPodatki.[Porabljen čas], tblPodatki.ZvrstProjekta, tblPodatki.Nalog, Sum([Porabljen čas]) AS Izr1
    FROM tblPodatki
    WHERE (((tblPodatki.Oddelek) Is Not Null) AND ((tblPodatki.AktivnostID) Is Not Null) AND ((Sum([Porabljen čas]))<>100));

    Any idea? ://

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    That query should not work even without the <>100. Aggregate functions (Sum, Avg, Count, etc) must be used in a Totals (GROUP BY) query. I don't understand why you are using Sum. Why not just:

    AND [Porabljen čas]<>100
    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.

  9. #9
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    Because every person have like this: work project 1 = 10%, project 2= 40%, project 3= 50%... then this is sum 100%, and in my report i have to show who didn't completed 100% (less or more)

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Saso has 3 items listed that total 100% so Saso should not be on the report?

    Sabina shows 275% (very busy!!) and should also not be listed?

    That leaves only Marta with less than 100%?

    Try:

    SELECT *
    FROM tblPodatki
    WHERE Oddelek Is Not Null AND AktivnostID Is Not Null AND PodatkiID IN (SELECT PodatkiID GROUP BY PodatkiID HAVING Sum([Porabljen čas])<>100);
    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.

  11. #11
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    Just Saso should not be listed cause only he completed the 100% demanded result, what's more or less must be on report.

    It won't save, it just colors this: (SELECT PodatkiID GROUP BY PodatkiID HAVING Sum([Porabljen čas])<>100);

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    I forgot FROM tblPodatki in the subquery:

    SELECT *
    FROM tblPodatki
    WHERE Oddelek Is Not Null AND AktivnostID Is Not Null AND PodatkiID IN (SELECT PodatkiID FROM tblPodatki GROUP BY PodatkiID HAVING Sum([Porabljen čas])<>100);
    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.

  13. #13
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    Nothing... Still shows all 3 records...

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    The technique works, I tested it. Have to get the correct field referenced.

    Is PodatkiID an autonumber field? Which field is the ID for people?
    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.

  15. #15
    sashless is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    12
    I UPLOADED IT HERE:

    http://www.sendspace.com/file/kl6u2r

    REPORT name is NEPOPOLNI_VPIS, query for this report is nepopolni_VPIS.

    You can check, i cound't manage it work

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filter based on part of value
    By bikeordie1 in forum Reports
    Replies: 3
    Last Post: 03-01-2013, 08:52 PM
  2. Replies: 5
    Last Post: 02-05-2013, 01:18 PM
  3. Filter Query based upon Checkboxes
    By olinms01 in forum Queries
    Replies: 2
    Last Post: 01-21-2013, 11:38 AM
  4. Replies: 16
    Last Post: 06-02-2012, 06:11 AM
  5. Replies: 3
    Last Post: 10-31-2011, 04:54 PM

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