cancel
Showing results for 
Search instead for 
Did you mean: 

Formula to provide a varaible the total value for a group

Former Member
0 Kudos

Hi,

I need to create a formula which outputs the value for a single group. For example, two groups are:

Group: Year

     Group: Products

I only need to place in the footer the total for year 2012, product jam. The report contains dteails for many products and years.

Any one help me with this formula?

Cheers,

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Leo,

Create this formula and place it on the Group Header 2. You may suppress this formula as we don't really need to display it.

WhilePrintingRecords;

numbervar summ;

if {Year} = 2012 and {Product} = "Jam" then

    summ := Sum ({Product}, {Year}))

Note. If the {Year} field is a date field, then you need to use a function to extract the year like:

Year({Year_field}) = 2012

Create another formula to display the sum and Place it on the Report Footer:

WhilePrintingRecords;

numbervar summ;

Hope this helps!

-Abhilash

Former Member
0 Kudos

Hi,

thanks for your help.

I had to adjust the formula which seems to work to the following where amount is the measure:

Sum({amount}; {Product})

I placed product as the category in the formula as this is the lowest level group.


Does that look ok?

abhilash_kumar
Active Contributor
0 Kudos

Yes, that was a mistake in my previous formula, sorry.

it should be Sum({amount}, {Product}) //it's a comma not a semicolon and the {Product} is the lowest level group right

-Abhilash

Answers (1)

Answers (1)

IngoH
Active Contributor
0 Kudos

Hello Leo,

take a look at the option to create  Running Total in Crystal Reports.

it also allows you to put in a logic which numbers should be totaled together.

regards

Ingo Hilgefort, SAP