How to get sum of values for specific rows

Phenomena

New member
Local time
Today, 14:50
Joined
Oct 31, 2013
Messages
8
I have a report being generated that pulls in a bunch of data. The processed column is a boolean value.

I want to be able to set the text of a label to be equal to the "material cost" for all the rows where is processed is set to false.

Picture of the report:
i.imgur.com/I0Y5W8X
 
A textbox in the report footer with this type of thing:

=Sum(IIf(Processed = False, MaterialCost, 0))
 
A textbox in the report footer with this type of thing:

=Sum(IIf(Processed = False, MaterialCost, 0))

Well that was simple, thanks!

I have another question. I used this same method to set the control source of txtMaterialPrice to be

Code:
=IIf(IsNull([Price]),[DefaultPrice],[Price])

So if Price is null, the control source uses the DefaultPrice instead of the Price.

This works fine in the sense that txtMaterialPrice displays the proper price, but when the report loads it prompts for a parameter. If no parameter is passed the report loads with all the prices in place and all of the calculated fields that use price populate as well, but the sum of the calculated fields don't display anything.

so txtMaterialPrice uses this Control Source (which works):
Code:
=IIf(IsNull([Price]),[DefaultPrice],[Price])

then txtMaterialCost uses this Control Source (which works):
Code:
=[Quantity]*[txtMaterialPrice]

Finally, txtTotalMaterialCost uses this Control Source:
Code:
=Sum([Quantity]*[txtMaterialPrice])

Which doesn't work.
 

Users who are viewing this thread

Back
Top Bottom