I have a formula that uses two shared numbers in it. I now need to sum this formula. If I use running total or sum functions, the formula does not show in the pick list.
The formula I need to sum is called "excel formula" and this is the calculation the formula is doing:
({#Shared Total Wt Lbs}*{#Shared Scrap})/100
The "usual way" of creating a sum or running total does not work for a formula that holds a variable .
To get a sum of it you'll need to use a third variable.
Place the following formula in detail-section to add up the values:
WhilePrintingRecords;
NumberVar SumOfExcelFormula;
SumOfExcelFormula := SumOfExcelFormula + {#excel formula}
Use the following formula to show the sum:
WhilePrintingRecords;
NumberVar SumOfExcelFormula;
To reset the sum on every group change, put the following code in a formula-field and place it on the group header:
WhilePrintingRecords;
NumberVar SumOfExcelFormula := 0;
Related
I want to show my Grand Total values by using a specific formula field.
Actually I want to sum formula fiel such as :
sum(#ClosingBalance)
But It gives a message
This Field Can not be summarize
How can I solve this problem ??
I solved my problem,
I explain below how can I solve this,
I need two other function to show grand total in my report footer, where I use formula field as my summarized field.
so, firstly I create a function name #Grouptotal by using below formula
Numbervar x:=x+{#ClosingBalance} And place it in my group footer
Then I create another formula name #GrandTotal and place it in my report footer
Numbervar x:={#Grouptotal}-{#ClosingBalance}
Finally I suppress the #Grouptotal Field , and get the result of #GrandTotal By using Formula Field.
Thanks a lot...
Yes, you can do this using variables.
Step 1: Create a Formula Field Named as Sum1:
Shared numberVar Sum1;
Sum1 := (Your Table Field) + Sum1;
Place this one in Details section and suppress it (Right Click Formula --> Format Field --> Common --> Suppress).
Step 2: Create another formula to display the result as PrintSum1:
Shared numberVar Sum1;
Sum1;
Place this formula in Group Footer and suppress it (Right Click Formula --> Format Field --> Common --> Suppress).
Step 3: Create another formula field:
Shared numberVar GrandTotal;
GrandTotal := GrandTotal + {#Sum1}
This way you can summarize a formula field. Place this one in group footer.
Step 4: Create one last formula as Clear:
Shared numberVar Sum1;
Sum1 := 0;
Place this formula in Group Header and suppress it. This is to clear the Sum1 value for every record or group.
Let me know if you have issues.
I have running total of a group, works fine but doesn't reset after every group.
My group header Formula:
whileprintingrecords;
numbervar SUM_A:=0;
numbervar SUM_B:=0;
Next I have a suppressed formula in the Details section:
if ({REPORT_DATA.A} = "Y") then
(shared numbervar SUM_A:=SUM_A+{REPORT_DATA.SUM_OF_A};)
else if ({REPORT_DATA.BM} = "Y") then
(shared numbervar SUM_B:=SUM_B+{REPORT_DATA.B};)
In the group footer I have several formulas as such:
whileprintingrecords;
shared numbervar SUM_A;
SUM_A;
Up to here everything works fine and the numbers add up. However, when the report continues and the second group begins, the SUM variable does not get reset (my understand is that it should because of the formula in the group header).
Any help would be appreciated.
Either your SUM_A variables are not the same or they are not being evaluated in a consistent way. Try the following:
Firstly, declare the variables consistently as either:
Shared numbervar sum_a; or
Numbervar sum_a;
... These are declarations for two different variables! Only add 'shared' if variables are being used in subreports and the main report.
Secondly, if you are using whileprintingrecords you generally need that in the other formulas working on those variables. So, add whileprintingrecords to the top of the other formulas with sum_a variables.
I have no idea why this didn't work.
I solved the issue by putting the formula field that zeros out the totals AFTER they have been displayed, in the group footer.
I have a very basic report with no groups. The details consists of a number of numeric columns. I want to add a formula field which will use a field from the first row. Example:
(ColumnAFromCurrentRecord - ColumnBFromFirstRecord) / ColumnBFromFirstRecord
Can someone point me in the right direction?
1.
Create a formula named AssignFirstValue and define it like this:
WhilePrintingRecords;
Global StringVar strFirstValue := {MYDBNAME.MYSTRINGFIELD};
Put the AssignFirstValue formula in your Report Header and suppress it.
2.
Create a formula named PrintFirstValue and define it like this:
WhilePrintingRecords;
Global StringVar strFirstValue;
strFirstValue
Put the PrintFirstValue formula wherever you want to display the first value in your report.
you need to extact the column b from first record. try below solution.
Note: This is not a tested solution as I at present I don't have CR.
create below formula Count and place in detail section:
Local NumberVar a;
a:=a+1;
This will number the rows starting from 1 to the last row.
Now create one more formula StoreB:
Share NumberVar b;
if {#Count}=1
then b:=columnb
This will store the value of columnb in first record in variable b
Now use where you want:
EvaluateAfter(#StoreB)
Shared NumberVar b;
(ColumnAFromCurrentRecord - b) / b
Let me know how it goes.
I have the following formula: #Sales_Cost
(Sum({Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount}, {Estimate_Retail_Inventory_Change___Detail.Inv ID}) -
(Sum ({Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount}, {Estimate_Retail_Inventory_Change___Detail.Inv ID}) *
{#GM%_For_Cost_Sales}))
This produces the following results and I have placed in my GH2 section:
592.77
1038.26
2628.38
3598.62
356.58
I want to total those values for my Report Footer, but I get the error message, "This field cannot be summarized".
How do I do this?
You need to create a manual running total. To do this you will create 3 new formula fields.
The first one goes in the report header to initialize the running total variable.
WhilePrintingRecords;
NumberVar manualTotal :=0;
The second one goes in the group header with your summary formula.
WhilePrintingRecords;
NumberVar manualTotal := manualTotal + {#Sales_Cost};
The third one goes in your report footer to display the calculated value.
WhilePrintingRecords;
NumberVar manualTotal;
manualTotal;;
Assuming {#GM%_For_Cost_Sales} will not vary within each Inv Id value (though it could vary across different values) and that the group for GH2 is on Inv Id, the simplest way to do this would be to change your formula item to:
{Estimate_Retail_Inventory_Change___Detail.Sales_Ret_Final_Amount} *
(1 - {#GM%_For_Cost_Sales})
- and place summed #Sales_Cost fields into both your GH2 group header and report footer sections.
Hi i have a long formula field which I would like to include as the cross tab report summary field. However after I define the formula field I don't see it in my crosstab screen. How to include it ?
Here is my formula field
WhilePrintingRecords;
numberVar rt;
numberVar layMdp;
numberVar totMdp;
rt=Round(({Command.GENGNPIAMT}/{Command.TOTALGNP})*100,2);
layMdp:={Command.GENPREMMDP};
totMdp:=(layMdp)*Truncate((rt/100),4);
Also if I place this formula field inside details section, it shows a zero. Why is it not calculating anything ? I like it to calculate values as per each cross-tab column.
You're setting the variables but the formula itself is not returning anything. If you want to return the value of totMdp, just add it after the last line:
WhilePrintingRecords;
numberVar rt;
numberVar layMdp;
numberVar totMdp;
rt=Round(({Command.GENGNPIAMT}/{Command.TOTALGNP})*100,2);
layMdp:={Command.GENPREMMDP};
totMdp:=(layMdp)*Truncate((rt/100),4);
totMdp