Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible in Crystal

Status
Not open for further replies.

morechocolate

Technical User
Apr 5, 2001
225
US
If I want to do something like the following, is it possible?

[(1 + row1 value) * (1 + row2 value)* (1 + row3 value)* (1 + rowN value)]-1

I tried doing a manual running total type thing, but I am doing something wrong.

First I made this formula:

WhileReadingRecords;
numberVar Return := 1 + {GeomerticLink.RETURN};

Then I was trying to figure out how to do a running total type thing, but got stuck.

I will, of course, keep working on this, but feedback is appreciated.

Thanks

mc
 
Create a Formula with just:

1 + {GeomerticLink.RETURN}

Drop it into the details and you can right click and select insert summary->sum or count.

You can then use the summaries created in a formula to subtract 1 from the total if that's the requirement.

-k kai@informeddatadecisions.com
 
Thanks for the prompt response k,

But only sums up the values, it needs to multiply the previous row by the product of the previous row.

So if I have

Apple 1 1
Pie 2 3
Pear 4 5

The second column is my formula above.

Now I need (1)*(3)*(5)
Then that result - 1

Thanks

mc

 
I tried this additional formula

WhilePrintingRecords;

numberVar TotalReturn := {@Return} * (TotalReturn + 1);
TotalReturn

Thing is everything after the decimal point is fine.

Meaning if I have my first formula result (see first post) I get:

0.998541
1.000004
1.000004
0.999896
1.000064

With the formula mentioned here I get

1.998544994
2.998548988
3.998445139
4.998509040

What I want is:
0.998544994
0.998548988
0.998445139
0.998509040

I'm having brain freeze.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top