Print Page | Close Window

How to calculate positive value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11002
Printed Date: 07 May 2024 at 3:21am


Topic: How to calculate positive value
Posted By: ifejza
Subject: How to calculate positive value
Date Posted: 31 Aug 2010 at 6:46am
Hi,

In my report i need to calculate sum for positiv and negativ value separatly. How to write formula?

Item 1    50,000
Item 2    12,500
Item 3    -9,000
Item 4     8,000    

   Sum(positive) 70,500 ???
   Sum(negative) -9.000 ???

Thanks in advance.

Imran



Replies:
Posted By: DBlank
Date Posted: 31 Aug 2010 at 7:04am

you can either

1. create formulas to do this
2. create variable formulas
3. Create Running totals
 
The easiest for the sample data given is option #1.
Create a formula named "Positive"
if field<0 then 0 else field
SUM the formula field
Create a formual named "Negative"
if field >0 then 0 else field
SUM the formula field
 


Posted By: ifejza
Date Posted: 31 Aug 2010 at 11:27am
Thanks DBlank

I take my data from XML file and real problem was a String type for number field.

I solve my problem and thanks again.

Imran,



Print Page | Close Window