Search code examples
crystal-reportssumformulamultiplication

Multiplying 2 Columns in Sum Function giving an error in Crystal Formula Shop?


SAP Crystal Formula Workshop detecting the error when I am trying to multiply two columns inside the SUM function. However, my logic is working absolutely fine in MS SQL. Following is my SQL Code:

select Sum(Qty * Type) from Movements

Where, type could be '1' or '-1'. I am using this statement to get the Balance. Following is my formula inside the crystal report formula shop which is giving an error:

SUM({MovementReport;1.Qty} * {MovementReport;1.Type})

Is there any other way to do it?


Solution

  • You have to create a separate formula field that multiplies the two columns:

    {MovementReport;1.Qty} * {MovementReport;1.Type}
    

    and then calculate the sum of that formula field:

    SUM({@YourNewFormula})