1
votes

I have a report with 2 group names - Customers and Products I'm trying to sum up a field "Total" From Orders for each product by customer but i only want to sum the lines with specific fields values

for example: If {OrderProducts.X} = Y And {OrderProducts.V} <> W Then SUM({OrderProducts.Quantity},{Products.ProductID})

when using SUM with condition field i get the entire sum without any regards to the the above field values.

i'd appreciate some help with this

(I'm using Crystal Reports 2011)

2

2 Answers

1
votes

Try a different approach:

  • create a formula field:

    //{@product} //generate a product for selected products; NULL otherwise If {OrderProducts.X} = Y And {OrderProducts.V} <> W Then {OrderProducts.Quantity}*{Products.ProductID}

  • Place formula on canvas (in Details section)

  • Select field, then select Insert | Summary ...
  • Remove formula field, if desired (it doesn't need to be on the canvas for the summary to work correctly)
0
votes

Try adding a "Running Total Field" (View >> Field Explorer)

Field to summarize - product.quantity

Evaluate - Select "Use a forumla" and give your condition there

e.g.

if (product.x=Y and product.v<>W) then 
product.quantity
else
0

Reset - select your customer field

Hope this helps