How to add a conditional grand total in Crystal Reports? - crystal-reports

I have a group running total that needs to be sum up at the report footer. Since thats not possible with CR I had to end up having another running total that refreshes "Never". But now I need to calculate some percentages at the group level based on this Grand total. Unfortunately I cannot access the value for grand total (because its another running total).
Confused?? Ok reports should look like below..
Column 1 | Colunm 2
======== =========
| Group 200 (Running Total Refresh at Group level) | 20% (200%1000) |
| Group 500 (Running Total Refresh at Group level) | 50% (500%1000) |
| Group 300 (Running Total Refresh at Group level) | 30% (300%1000) |
Footer 1000 (Running Total Never Refreshed)
But column 2 doesn't give me the correct value. it gives me 100% always means 200%200 or 500%500 etc.
Any idea how to fix this??

Thanx Lee, using a running total formula worked, I added following formula to the report footer,
numbervar Samples;
if {product.sku}="card-sample" then
Samples := Samples + {#num_qty};
Samples;
Then I use this formula to calculate column 2

Try this
Add a formula field for group percentage and then paste below code in it.
Group total / sum(column)
place this formula at your group level.

I should think your report total wants to simply be a summary field not a running total. Then your column 2 value can be calculated using running total / sum(field);
Here is an example:
I have two columns age and salary.
When age > 18 i want to add the salary.
Initially I used a running total with a condition {age} > 18
That didn't work well so i deleted the running total, and created a formula: if {age} > 18 then {salary} else 0
I then created a summary on that formula field.
Make sense?

Related

How to Subtract Group total of same field in crystal Reports

Say I have Fields Like
SNo-----S/F----Amt
1--------S---------100
2--------S---------100
3--------S---------100
4--------S---------100
---------------------400 -> Group Total
1--------F---------100
2--------F---------100
3--------F---------100
---------------------300 -> Group Total
1--------R---------100
2--------R---------100
---------------------200 -> Group Total
I want to do like (Grouptotal-S) + (Grouptotal-F) - (Grouptotal-R)
More Like 400 + 300 - 200 = 500 as Grand Total.
I searched the internet and came across evaluateAfter but didn't understand how to apply because all the example shows group subtract between 2 different fields and I have a single field here i.e (Amt) in different Groups
Edited :
To understand more, I am adding some images below.
Image 1:
Image 2:
Note: I solved my problem by using RunningTotal but I have to take 2 running totals for 1 field and I have approx 5 fields to do the same.
I just want to know if there an easy way just subtract the group total of the same field??
Please rectify me if I am wrong somewhere in the question.
Thank You
Does the formula not work for this?
Have you tried creating a new formula and you can find your group totals under Report Fields. Write your formula as needed and then you can place that formula in the report/page footer.
Example
(Group 1 SUM + GROUP 2 SUM) - GROUP 3 SUM

Crystal Report XI: calculate subtotal % of total

I have a report that calculates a summary field by group location which I am calling a sub total. There is another summary field by company in group company section. We allocate corporate overhead costs based on volume of revenue. I need to take the location total revenue and divide by the overall company revenue to get the % of volume. My problem is that I cannot get the company total into the location group row without effecting the numbers. I have tried to create a running total field to get the total. I have tried referring to the main report to get the company total and I have tried summarizing the location totals but I cannot summarize a summarized field. Any suggestions would be really helpful, thank you!
Company Locations---------- Total Revenue-------- % of Volume
California------------------------ 500,000----------------- 500,000/950,000 ?
New York ---------------------- 300,000
Ohio ---------------------------- 150,000
Company Total: -------------- 950,000
This looks like the same thing I am trying to do but I don't understand the answer yet..
http://www.experts-exchange.com/questions/27749404/Crystal-Reports-XI-fixed-value-for-denominator.html
your best option is creating a subreport on the report header to calculate only your total revenue and then using it on your main report through a shared variable.
if sum({totalRevenue},{location}) > 0 then
sum({totalRevenue},{location})
/
sum({totalRevenue})

How to calculate the sum total of separated group field in Crystal Report

I am making a report in "SAP Crystal Reports" and I need to calculate the sum total of the group field. Report is grouped by user name, I made the "Running Total Fields" field and it calculates all of them as in example below:
UserName 1 2
3
1
-----------
6
UserName 2 1
2
-----------
9 <------- I need here 3
Does anyone know how to solve this?
Thanks in advance.
Two options:
edit the running total field and reset it after each group (it is now generating a total for all records).
use a summarized field - select the field in the details section and choose Insert | Summarized Field...
I would also suggest reading a book on the topic.

Crystal Reports - group total at begining of group

I have this report:
Question Group
----Question - [TOTAL]
--------Answer 1 (10)
--------Answer 2 (0)
--------Answer 3 (8)
--------Answer 4 (2)
----Total: 20
Total: 20 is calculated with running total field, and it can only be calculated after each question finishes.
What I want is to place this value at the beginning ([TOTAL]), so it can be used to calculate percentages (--------Answer 1 (50%)).
I tried with formulas, with no success.
I managed to change the SQL that feeds the report and then used a formula to do what I want
count({newfield},{group})

SSRS - show row total in column

I am working on SSRS 2008.
I have a report as follows, I want the toal of Amount in Total column. I am not able to get total in column. I have tried Add Total / Sum() features of SSRS but no luck.
+---------+-------+--------+-------+
|Supplier | Agent | Amount | Total |
+---------+-------+--------+-------+
| | A10051| 237.2 | |
|S2005068 +-------+--------+ |
| |A10052 | 23.8 | |
+---------+-------+--------+-------+
I think your design is not proper. The total row in the last column will be under the details group. If you want a total on the last column you can get but for-each row it will repeat. use
=Sum(Fields!Amount.Value,"Supplier") here Supplier is the "Group Name"
To avoid this repeatition we need to add the total column inside the supplier group and use =Sum(Fields!Amount.Value) for total
or
Right click on the Amount column data -> Add Total -> Before or After. This will display the sub-total for the Supplier group in the same Amount column after/before as you selected.
Add total on the supplier group, add it before or after, depending if you want it on top or bottom. SSRS will fill in =SUM(Fields!Amount.Value) and show the total 268 below.
To make a Total Rows =countRows("dataset")