cancel
Showing results for 
Search instead for 
Did you mean: 

Grp & Rpt Sums used for % Calc not giving same total...

crazycrystal
Explorer
0 Kudos
194

I have a CR2013 report design that has the following sections: Report Header, Group #1 {Customer}, Detail (suppressed), Group #1 Footer, and Report Footer.

Detail Section has {InvoicedAmount}, {PaidAmount}, {CostTotal}

  • Grp #1 Footer has the following columns:
  • Sum({InvoicedAmount}, Customer)
  • Sum({PaidAmount}, Customer)
  • Sum({CostTotal}, Customer)
  • @%Paid = ((Sum({PaidAmount}, Customer) / Sum({InvoicedAmount}, Customer))/100
  • @ExposedAmnt = Sum({CostTotal}, Customer) * @%Paid.

But, If I manually add up the Group #1 amounts for @ExposedAmnt, they don't equal the report footer formula for the same. I think this is because I have to "recreate" the @ExposedAmnt and @%Paid formulas in the Report Footer which gives me a different % value and a different @ExposedAmnt Value for the Report Footer. So my question is this: How can I get a Group formula to total down (sum) for all the group values above added together?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

crazycrystal
Explorer
0 Kudos

I was able to solved my problem with your advice above! Thanks

Answers (2)

Answers (2)

crazycrystal
Explorer
0 Kudos

Thanks Dell ! So I left out the If's for the ZERO value (div by 0) to simplify the post I made sorry. Yes, I will flip the multiply vs divide as well, and I didn't know about the "%" option! Thanks for educating me !!!!

I do need to figure out how to do a global value ! I'll use what you showed above and give it a try !

Thanks !!!

DellSC
Active Contributor
0 Kudos

Your formulas here are for data at the group level, so they reflect each specific group. You cannot sum percentages to get a total percent - as you have found, it doesn't work that way. Instead, you'll need to create grand totals that don't split by customer and use them.

A couple of additional comments:

- Your percentage formula is wrong - when doing it using division, you need to multiply by 100, not divide. However, you can use the "%" operator in Crystal that will automatically do both the initial division and then multiply by 100. See below.

- You need to be checking for 0 values so that you don't get "division by 0" errors.

As an example, here's what your grand total formulas should look like:

{@Invoice Total}: Sum({InvoicedAmount})

{@Paid Total}: Sum({PaidAmount}, Customer)

{@Cost Total}: Sum({CostTotal}, Customer)

{@Total%Paid}:
  If {@Invoice Total} <> 0 then
    {@Paid Total} % {@Invoice Total}
  Else 0

{@TotalExposedAmnt}:
  If {@Total%Paid} <> 0 then
    {@Cost Total} * ({@Total%Paid}/100)
  Else 0

-Dell