Results 1 to 10 of 10
  1. #1
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6

    How to add summing the field based on certain criteria

    Hi,

    I need your help with the following:
    I have a database (attached) with AllData Query. I would like to add few other numeric dimensions to this query, in the way shown in attached excel. Could you please help me in it? This seams to be very easy, cant be diffficult if in excel it is basically one formula sumifs... but I failed so far in having it done

    Thanks a lot for any help



    //Draszor
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Looks like you need to build a report with the AllData query and use report Grouping & Sorting with aggregate calcs functionality.

    Otherwise, what you want will require some complex DSum function calcs or multiple queries to accomplish.
    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
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6
    Quote Originally Posted by June7 View Post
    Looks like you need to build a report with the AllData query and use report Grouping & Sorting with aggregate calcs functionality.

    Otherwise, what you want will require some complex DSum function calcs or multiple queries to accomplish.
    Can you attach some example? like adding one discount to my DB, so that I could follow..?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    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
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6
    Thanks a lot. I will definitelly review this.

    There is a problem however with such set-up...

    I am using a different software (QlikView) to built the presentation form (charts/tables/quick and easy filtering) out of my Access Data. So, access file should be just a database, nothing else... The problem is , that QlikView can expoer tables, queries BUT NOT REPORTS from access... so I need to create a query, because with report it won't work...

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Okay, might be able to accomplish with domain aggregate functions (DSum, DCount, DAvg, etc). However, they can make queries run slow. But I tested calcs and they ran fast on this dataset. Example:

    12_VD: DLookup("[12_VD]","[DedVDT]","[VDCustomer]='" & [VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'")
    13_VD: DLookup("[13_VD]","[DedVDT]","[VDCustomer]='" & [VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'")

    Enter that code in cells of Field row with the AllData query in Design view. To show as percent:
    12_VD: Format(DLookup("[12_VD]","[DedVDT]","[VDCustomer]='" & [VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'"),"Percent")
    13_VD: Format(DLookup("[13_VD]","[DedVDT]","[VDCustomer]='" & [VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'"),"Percent")

    You have VDCustomer values that are not in DedVDT table so some of these calcs will be null result. Why are the values in 12_VD and 13_VD fields the same?

    QlikView can import from Access? Can it import from Excel?
    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
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6
    Thanks a lot. I will try this today definitelly.

    QlikView - yes, it can import from any data base - starting from .txt .csv files, via excel, access, SQL finishing with ERP platforms like SAP...
    Wonderful program, I am really fan of it - very flexible, very user friendly (herer I mean the final user of the report).

  8. #8
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6
    I checked your formula with one discount and it works perfectly, I am really grateful for your help... I needed to modify it a little bit, so finally it is:

    12_VD: Format(DLookUp("[12_VD]";"[DedVDT]";"[DedVDT.VDCustomer]='" & [CustomerT.VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'");"Percent")

    but it works and this is it... FINAL QUESTON... WHAT NOW WOULD BE THE SIMPLEST WAY TO MODIFY THIS FORMULA SO THAT THE ZERO VALUE IS ENTERED IN ALL RECORDS HAVING NOW NULL VALUE FOR 12_VD COLUMN ..?

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Try:

    12_VD: Format(Nz(DLookup("[12_VD]","[DedVDT]","[VDCustomer]='" & [VDCustomer] & "' AND [VD_Type]='" & [VDType] & "'"),0),"Percent")
    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.

  10. #10
    Draszor is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2012
    Posts
    6
    Thanks a lot... so simple... ;-))

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

Similar Threads

  1. Replies: 9
    Last Post: 06-28-2012, 10:10 PM
  2. Criteria based on value in another field
    By karusya in forum Access
    Replies: 1
    Last Post: 04-03-2012, 01:46 PM
  3. Criteria based on another field
    By jlclark4 in forum Queries
    Replies: 12
    Last Post: 02-14-2012, 12:29 PM
  4. Replies: 5
    Last Post: 03-06-2011, 10:38 AM
  5. Replies: 4
    Last Post: 01-19-2010, 05:36 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