Results 1 to 7 of 7
  1. #1
    whamilton is offline Novice
    Windows 10 Office 365
    Join Date
    May 2021
    Posts
    6

    Calculate column in report but only the rows that the value in another column equal value "x"

    I'm trying to make a calculated text box in a Report. I need it to only sum the values in [Total Value] if the value in [Stages]="1"



    I haven't been able to come up with the correct syntax.

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Usually easier to create a calculated field in the query behind the report, then bind the report control to it. However, the report structure is not clear. [Total Value] and [Stages] are fields in the detail section (they repeat for each record)? Or is this calculation being done over a group? A pic of the report design showing these controls might help.
    Last edited by Micron; 05-27-2021 at 12:45 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    whamilton is offline Novice
    Windows 10 Office 365
    Join Date
    May 2021
    Posts
    6
    I've attached a screenshot of the report design. My intent is to have several total fields at the top of the report. A sum Total Value for the entire report and then a sum for each of the Stages.Opportunities Report.pdf

  4. #4
    whamilton is offline Novice
    Windows 10 Office 365
    Join Date
    May 2021
    Posts
    6
    I've attached a screenshot of the report design. My intent is to have several total fields at the top of the report. A sum Total Value for the entire report and then a sum for each of the Stages.Opportunities Report.pdf

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    You could try:
    Total Value Stage 1: =Sum(IIf([Stages]='1',1,0)
    Total Value Stage 2: =Sum(IIf([Stages]='2',1,0)
    etc.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Or maybe: DSum("Total Value", "Your Table", "Stages = 1")

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    You could use this formula in the controlsource for a textbox in the report header or footer

    =sum(-totalvalue*(stages=“1”))

    Only include the brackets around 1 if the stages field is text, numbers do not use identifiers

    For the future, tell us what you have tried and why it didn’t work - error message, wrong result , something else

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

Similar Threads

  1. Replies: 8
    Last Post: 04-21-2021, 09:44 AM
  2. Replies: 8
    Last Post: 04-18-2021, 10:48 PM
  3. Replies: 52
    Last Post: 09-22-2015, 04:48 PM
  4. Column sum works in "Detail" but not "Footer"
    By Doodlebug2000 in forum Reports
    Replies: 1
    Last Post: 12-10-2012, 03:20 PM
  5. Replies: 6
    Last Post: 07-25-2012, 06:42 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