help with conditional sum on report (1 Viewer)

Aryzona

Member
Local time
Today, 14:01
Joined
Nov 14, 2020
Messages
49
I have a report where BWTID is grouped. I have the summary total in the footer for EMPDH (employee hours). I am trying to create a summary list of each bwtid and the total hours for that btwid.

I tried this and it worked beautifully for the first one:

=IIf([bwtid]=2,[Text26],0)

but failed and returned a zero when i changed the btwid to 4.

so i tried this:

=Sum(IIf([bwtid]=4,[empdh],0))

and i get #ERROR ... the correct answer here should be 11 ! see below :

1629238404792.png


What am i missing ?

Thank you !
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:01
Joined
Aug 30, 2003
Messages
36,118
Looks like the 4 should have worked. The other effort refers to empdh, which may be an invalid name or the name of a control, which will confuse Access.

Personally I'd use a subreport based on a totals query. It would be more dynamic, showing whichever bwtid's existed automatically.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:01
Joined
May 7, 2009
Messages
19,169
you only need to Add Footer to your btwid Group.
so you do not need to use Conditional Sum.
see demo for better explanation.
 

Attachments

  • bwt.accdb
    456 KB · Views: 390

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:01
Joined
Aug 30, 2003
Messages
36,118
so no need for Additional subform:cool:

From the pic it appears the OP wants all the summary values displayed in one place, in addition to individually in the group footer. A subreport is certainly not needed, but would be more dynamic than hard-coded textboxes for each potential group value. Apparently you feel differently, and that's okay.

I appreciate you editing out the rude comment.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:01
Joined
May 7, 2009
Messages
19,169
I appreciate you editing out the rude comment.
you answer the op and not me. don't be sarcastic toward other post. respect is earned!
 

Users who are viewing this thread

Top Bottom