Formulas on Groups
Post Author: Joy Hampson
CA Forum: Crystal Reports
I am working from CR XI. I have created two groups using a formula, TeamA and AllOthers. TeamA is derived from a Dynamic Parameter field. These two groups have 14 areas in which they are scored. I have added subtotals to the Group Footer to illustrate how each TeamA is doing and how AllOthers is doing. However, I want to display (graphically if possible) how much better/worse TeamA is compared to everyone else.
For example, in the area of Sales, TeamA is 3 points ahead of AllOthers, however in the area of Marketing, TeamA is 1.8 points behind AllOthers.
Hi,
I assume you have a PCR where the amount of WT0001 is moved to WT1452.
If you add a decision WPALL?LAST to this PCR, you first query whether the split period processed is the last one in the payroll period.
If the split ain't the last (return value 'N'), then do nothing, just add ADDWT *.
If the split period processed is the last, process your PCR as it's currently.
Wilfred.
Similar Messages
-
Formula by Group and based on a condition
Post Author: Ravi
CA Forum: Formula
Hi All,
I need to create a formula by Group and based on a condition. Below the syntax is wrong but this is the calculation that I am after!
Sum({@Test_Dollars}, ) where {Customer Number} = 12
Basically, I need to display/calculate the 2nd column in the sample report/output.
All Customers Only Customer 12
Company $500 $125
Zone A $200 $50
Zone B $300 $75
Thanks in advance,
RaviPost Author: Jagan
CA Forum: Formula
I think you should be able to get this from a running total with a formula to only include records where the customer number - 12 -
Post Author: vondee
CA Forum: Crystal Reports
I have a report grouped by year, with a percent total for each year that is calculated in a formula from running totals:
2004 - XX%
2005 - XX%
2006 - XX%
2007- XX%
I want to add a formula next to the percent that calculates the difference between that year's XX% and the previous year. So the result of 2007 XX% - 2006 XX% appears in the 2007 group. The result of 2006 XX% - 2005 XX% appears next to 2006, etc.
Is this possible in Crystal? Thanks for any ideas-Post Author: kcheeb
CA Forum: Crystal Reports
Seems to me there's a prevrow function that can be used to return a value. Not sure if I'm remembering correctly or not and what the behaviour is in a group. -
Formula help - Group totals for more than one date range
Post Author: melcaylor
CA Forum: Formula
I need to show in 3 columns
inside of a grouping that totals an amount field based on a date
range that amount was posted. So for example:
Billy Bob in the state of MA made $5.5m total, $800k in the last 21 days, $400k in the last 14 days and $150k in
the last 7 days.
I assume this is possible but I
just donu2019t know what type of formula to write to make it work. For this
example, there are 2 tables u2013 user table and $$ table. The User table has
the user name, the $$ table has the pay date and the amount.Post Author: SKodidine
CA Forum: Formula
You only need simple formulae in Running Totals to accomplish this.
1. Group by Name
2. Create the following Running Totals:
2.1 A running total to sum the pay amount for all records, and resets on 'Change of Group' of Name.
2.2 A running total to sum the pay amount and for 'Evaluate' click on the radio button next to 'Use a formula' and then click on X-2 button next to it.
In the formula workshop window type a formula such as: {table.payment_date} in (currentdate - 21) to currentdate;
For 'Reset' click on the radio button next to 'On change of group' and pick the group name.
2.3 Create another running total just as in step 2.2 above but change the formula to: {table.payment_date} in (currentdate - 14) to currentdate;
2.4 Create the last running total just as in step 2.2 above but change the formula to: {table.payment_date} in (currentdate - 7) to currentdate;
Hide the details section and in the group footer place text boxes with appropriate text and insert these running totals to give you the numbers you want.
The only issue I see with this is if a person was paid yesterday a sum of $25, then it will show $25 for total, last 7days, last 14days and also for last 21days. At first look it might be mistaken for $75. -
CRXI: Formula To Loop Through Formulas in Group
Post Author: Mile
CA Forum: Formula
I have a hierarchy of groups allowing the drilldown of data. Due to a flaw in database design, there is no real join between two tables and I've improvised as best I can. The problem is that on one of my items, there can be as many as thirteen products attributed to it. This produces thirteen records for the one item, meaning that summing on the amount field will be thirteen times the actual amount. But, as I said, each product may have a different number of products attributed to it, meaning it could be five times the amount, seven times, the amount, etc.
I've been able to make a summary at the item level whereby all I need to do is a formula that divides the sum by the count of products to get the actual value. When I move to the next group level up, I find that it can't mathematically be done to divide the summed amount because one item in the group may have two products (therefore two records) and another ten products.
What I'm wondering is whether there is a way, using a formula, that can loop through all the items in a group and add the summary field.
i.e.
ITEM1 - PROD1 - $5
ITEM1 - PROD2 - $5
ITEM2 - PROD1 - $7
ITEM2 - PROD2 - $7
ITEM2 - PROD3 - $7
ITEM2 - PROD4 - $7
ITEM2 - PROD5 - $7
ITEM1 would summarise to $5, once I've divided it by two. ITEM2 would summarise to $7, once I've divided it by five.
So, ideally, I would loop through a group above the item level, adding the summaries, ending with $12.
Can this be done?Post Author: synapsevampire
CA Forum: Formula
Your difficulty is termed record or row inflation.
If you want a summary at the group level, group by the item field and use a maximum instead of a sum.
maximum({table.value},{table.item})
Then to get a grand total, create a formula such as the following for the gropup footer:
whileprintingrecords;numbervar MyTotal;MyTotal := MyTotal + {table.value}
Now you can display the grand total in a subsequent secion using:
whileprintingrecords;numbervar MyTotal
-k -
Hello, I'm having a problem getting this summary to work. I have a group {PRDT.PREndDate} which is a date field and I have a sum formula that adds two fields. The problem is when I try to limit the sum to the {PRDT.PREndDate} group I get an error "There must be a group that matches this field". I'm sure I'm missing something in my formula.
here's the formula:
sum({@EC1}, {PRDT.PREndDate})+
sum({@EC2}, {PRDT.PREndDate})
Thanks,
GeraldMy Group Header #2 is {PRDT.PREndDate} , does it matter that the field type is Date? Here are the other formulas:
@EC1
if {PRDT.EDLType}='E' and {?EC1}={PRDT.EDLCode} then
-({PRDT.Amount})
else
0
@EC2
if {PRDT.EDLType}='E' and {?EC2}={PRDT.EDLCode} then
-({PRDT.Amount})
else
0
Edited by: akamax_power on Aug 5, 2009 6:51 PM
Edited by: akamax_power on Aug 5, 2009 6:53 PM -
I need to count records like -
Formula A - "if {'Accounting Code 08 Value} < 1 then 0 else {?Date as Number} + {@Count Invoice #}
"Date as Number" is just that" and
"@Count Invoice" is "WhilePrintingRecords; NumberVar InvoiceCount:= InvoiceCount + 1"
But I need to create a Group so I can sum data by Formula A, currently it is not a selection in group expert even though it is on the report. Any ideas???
THANKSHi Bill
Based on what field you want to create a custom group is not clear. If you want to create a group based on your {Accounting Code 08 Value} then you will have to write a formula and insert the formula as group and go in group options and select the specified order.
Formula @Group
If {Accounting Code 08 Value} >= 1 and {Accounting Code 08 Value} <= 100
Then "group 1"
Else
If {Accounting Code 08 Value} >= 101 and {Accounting Code 08 Value} <= 200
Then "group 2"
Else
If {Accounting Code 08 Value} >= 201 and {Accounting Code 08 Value} <= 300
Then "group 3"
Else
"Group Others"
This will create group1,group2,group3 and Group Others groups.
Thanks,
Sastry -
Data Concatenation - Looking to have result in the Group header
Dear all,
Few months ago, I try to concatenate cells under a Group,
I succeed using the formula gave by Raghavendra
Initialize:
whileprintingrecords;
stringvar i:="";
Place the above formula in group header and suppress group header section.
evaluate:
whileprintingrecords;
stringvar i;
i:=i", "name field;
Place the above formula in detail section and suppress the details section.
display:
whileprintingrecords;
stringvar i;
country field" - "i;
Place the above formula in group footer and right click go to format field and check the option "can grow" in common tab.
My today issues is that I'm still looking for concatenation but I need it in the Header of the Group, not in the footer
As far as I understood
- Crystal Report is reading line by Line, so I can't retrieve the value in the Header before the value are calculate.
- Moreover I've issue on initialize the value
I thougth an GlobalVar Array can work, but I can't find the way to do it
My request is, I've have this DataSet
Paris | Louvre
Paris | Eiffel
Sydney | Opéra
I'm looking Group on City to have in the Header, the value concatened
Paris | Louvre, Eiffel
Sydney | Opéra
Thanks in advance
Edited by: Alexandre VANNIER on Dec 2, 2008 2:09 PMif i have manual running totals that need to display in the header i do the following
i create the group - ie- jobid
i either insert a sub group below or create a 2nd group with the same field
then i create a 3rd group with the same field
i place my reset in the 1st group
calc in 2nd
display in 3rd -
How to create a group with multiple data fields
Post Author: RichS
CA Forum: Formula
Using CR XI. Using CSV input from ODBC text driver. No problems here.
There are 3 fields that I want the same group by action. Is this possible?)
If any one of these 3 fields change I want some header information and column fieldnames to display. The header information I only want displayed on the first page (on the change) and the column fieldnames to display on every page. I have played around with things like "InRepeatedGroupHeader" and "report group header on each page". I am not getting all the results that I am looking for though.
I want report to look like:
Page header stuff (to display on every page) This data consists of some fields that will have static data and will display on every page. And it consists of 3 non-static fields that I want to group on.
Group header stuff that I only want displayed on the first page on a change from one of the 3 fields mentioned above.
Column headings that I want displayed on every page.
Details data
Group footer stuff (details not important for this)
I get the expected output (column headings displayed on every page, and group header stuff display on the first page on each group change) with one group field. But I want the group change to happen for all 3 fields.
It seems simple but I can't find a way to create a "group" so if "field1 or field2 or field3" change, I get the same "group by" action. I just need to know how to get the expected action.
I expect that I might have some terms mixed up and/or some important information that would aide you in helping me. If that is the case please re-post and I will add any missing or mis-stated information.
Thanks,Post Author: V361
CA Forum: Formula
I am slightly confused, but perhaps you can create a formula
Then group on the formula. If this is not what you want, could you post some sample data, with the desired results. -
Need a formula for 12 months data, 6 months data and 3 month
Hi All Crystal Experts,
In my report, data is grouped by months and I have monthly view of data. I have three prompts- Year, Startdate and Enddate. If I give 2013 as year, 1/1/2013 as start date and 05/01/2013 as end date then report shows monthly view of data for Jan-13, feb-13, Mar13, Apr-13 and May-13. Now in report, for each month, I want three additional columns, I want to show last 12month, 6 month and 3 months view. Like for Jan-13 month, in column 6 months, I want to show data for last 5 months including current month i.e. Jan-13+Dec-12+Nov-12+Oct-12+Sep-12+Aug-12 and in Column 12months view, I want to show accumulated data of last 11 months(+ current month) and in 3 months view, data for last 2 months(+ current month).
I had tried creating Sub report for 12 months view and created Running total formula but it is not showing any value in report. It is blank. I have created running total like this way:
(1) "Running total formula" (which I am using and placing on group footer):
(I) Field to summarize- @Cash_total
(ii) Evaluate (use a formula):
WhilePrintingRecords;
NumberVar Cash_total_12 months;
If Month ({@Month_PostDate}) In [(Month {?StartPostDate} - 11) to Month
{?StartPostDate}] Then
Cash_total_12 months := Cash_total_12 months + {@Cash_Total};
(iii) Reset (use a formula):
WhilePrintingRecords;
NumberVar Cash_total_12 months=0;
When I placed this formula in group footer, it is showing nothing.
Please suggest me formula. Quick help would be much appreciated.
Thanks,Hi Remi,
Please do not post multiple threads for the same issue.
Continue discussion on this thread:
How to calculate last 12 months, 6 months, 3 months data in report
-Abhilash -
Sorry for length of htis post.Only way to describe issue was with example.
I have a report which lists details at Store levels.
Input Data is as follows: [ Simplified ]
Store Name Store Id Details
Bath 0001 0001aaaa
Bath 0001 0001bbbb
Bath 0001 0001cccc
Chelsea 0678 0678aaaa
Chelsea 0678 0678bbbb
Chelsea 0678 0768ccc
Derby 0500 0500aaaa
Derby 0500 0500bbbb
Derby 0500 0500cccc
etc.
I grouped the Report by Store Name.
There is no summation - or data manipulation required.
The reason for Groupng is simply to allow:
a) To Group and Sort Report by Store Name
b) To throw page after each Store
c) To facilitate Group Tree.
Expected result.
Bath 0001
0001aaaa
0001bbbb
0001cccc
Throw page
Chelsea 0678
0678aaaa
0678bbbb
0768ccc
Throw page
Derby 0500
0500aaaa
0500bbbb
0500cccc
Throw page etc
Actual Result:
*Bath 0001*
*0001aaaa*
*0001bbbb*
*Throw page*
*Bath 0001*
*0001cccc*
Throw page
Chelsea 0678
0678aaaa
0678bbbb
0768ccc
Throw page
Derby 0500
0500aaaa
0500bbbb
0500cccc
Throw page etc
So Bath [ in this example ] has two Groups.
Bath is shown twice in the Group tree.
One Group Displays all Subdetails - Except one
The second Group Displays only One line of sub details.
This only occurs for one store [ out of 200 or so ]
Initially this occured for one store. Which was arbitary [ i.e. Not nec. the first alphabetically ].
In the end I enforced the sort order in the SQL which produced the data.
This had the effect of moving the issue to the first store [ alphabetically ] but stil onlu one store.
Obvious stuff.
I have checked the data. The value 'Bath' is derived from the same field in all cases.
[ It picks up store name from a lookup table to decode the Store number for a more meaningful display ]
So there is no possibility that this is data related.
This issue has been driving me mad.
I eventually had to use a work-around; where I grouped by Store Number instead;
This had the expected effect. Although the Group Tree is not as user friendly and the group is not in alphabetic order.
The users use store name & store number with equal familiarity - so they are happy for now.
But I need to know what happened here.
Edited by: Joe Coen on Jun 9, 2009 1:29 PMWell, I waded my way through it, and (provided I got the right end of the stick), I'd start with the following to figure out what's going on. My thinking is that there are two groups - probably different storeNumbers, but with the same (or similar) names:
Have group on StoreName, and also another on StoreNumber - that way when you get to the Bath groups, you can see what StoreNumbers they relate to. This might highlight the fact you have a "Bath" and a "Bath " (leading/trailing spaces), or two "Bath" stores. I know you say you've checked the data, but it's worth double-triple checking before you go mad.
You could also check for the trailing spaces by having a formula to group on (rather than the store name) that takes the form of ">>>""<<<" - this would highlight any leading/trailing spaces. -
How to develop a group above report in mailing lable style
i want to know the method to develop a group above report (multi level groups) in mailing lable style like yellow pages on reports 6i e.g.
group 1: country
group 2: province
group 3: Industry
group 4: product or service
mailing lable: Company Name
Address
Contact No
I will highly appreciate if someone can help in this regard
M. Imran Shahzad
[email protected]Post Author: V361
CA Forum: Formula
I am slightly confused, but perhaps you can create a formula
Then group on the formula. If this is not what you want, could you post some sample data, with the desired results. -
Getting running total formula result at the beginning of the report
Hello All,
I am having an inquiry that if I can get a grand total in the report footer to the report header.
The grand total is not a direct sum. I am using three formulas
the first formula:
@reset Group Header
whileprintingrecords;
numbervar sumpct4;
if not inrepeatedgroupheader then
sumpct4 := 0;
the second formula: Details section
whileprintingrecords;
numbervar sumpct4 := sumpct4 + {@Total_Market}; // {@Total_Market}; = Amount+ Interest
numbervar grtotal4 := grtotal4 + {@Total_Market};
Group Footer
whileprintingrecords;
numbervar sumpct4;
Report Footer
whileprintingrecords;
numbervar grtotal4;
All that I need is to show the total which is in the report footer at the top of the page where I am having a summary.
So, can you please help me.
Thanks
Edited by: maas maas on Sep 8, 2010 12:48 PMHello my friend,
I want this to be controlled in crystal.
Is there is a way to get the grand total by using multiple formulas or any other way?
Here is the structure of my report:
Group Header 1: CCY
Group Header 2:Type
@reset Group Header
whileprintingrecords;
numbervar sumpct4;
if not inrepeatedgroupheader then
sumpct4 := 0;
Group Header 3A: Deal No
Group Header 3B: Deal No (subreport to get the {@amount} for each deal)
I will pass the end_date from the main report to subreport and I will get the sum(amount) for each deal between date (1-1-2008) to end_date. The sum will be as a shared variable to the {@amount} formual in the main report.
Details:
Deal No, {@amount}, {@Price}, {@market}, {@Total_Market}
{@Price}: if {table.price} = 0 then
100
else {table.price}
{@market}: if Type <> "DEP" then
({@amount}*{@Price})/100
else
{@amount}
{@Total_Market}:{@market}+ {@Price}
Running formula to get Total_market: Details section
whileprintingrecords;
numbervar sumpct4 := sumpct4 + {@Total_Market};
numbervar grtotal4 := grtotal4 + {@Total_Market};
Group Footer 3B: Deal No
Group Footer 3A: Deal No
Group Footer 2:Type
In this group I am placing a running total formula:
whileprintingrecords;
numbervar sumpct4;
Group Footer 1: CCY
Report Footer:
@grand_Total
whileprintingrecords;
numbervar grtotal4;
Now, i want this @grand_total formula result to be shown in Group Header 1: CCY.
I tried to insert a subreport at the beginning which it is a copy of the main report, but I did not get the coorec t result because I am getting the {@amount} from a subreport and in crystal I can't insert a subreport in an existing subreport. -
I have a quantity field in my main report that I passed off to my subreport. In the subreport I took the quantity field and placed it in a formula ({@Valuation Material Costs}*{@Qty from Main Report}). This is placed in the Group Header. Now I want to setup a grand total of this formula but I can not figure out how to get there. Any ideas?
If your formula already contains any summarized fields then you cannot summarize that formula. Try creating a mannual running total like this
whileprintingrecords;
numbervar i;
i:=i+@formula;
Now place this formula in group footer or header and suppress this formula. Create a new formula like
whileprintingrecords;
numbervar i;
Place this in report footer which shows the grand total.
Reagrds,
Raghavendra -
Grand Total formula different from Subtotals
Hi,
i've a question. Suppose i have a normal table (No pivot) with 2 columns: Month and Salary percentage on Month.
In addition i have subtotals on Month column and a Grand Total. I have a situation like this:
Month Salary percentage on Month
30
January 20
50
January Subtotal 100
20
February 70
10
February Subtotal 100
Grand Total 200
In Salary percentage on Month field I have as aggregation rule Sum because i want that subtotals are the sum of single rows of the month.
But i don't want this for grand total. It should be 100 (max of subtotals).
Is it possible specify a different formula for Grand Total respect to that used for Subtotals?
Thanks
GiancarloIf your formula already contains any summarized fields then you cannot summarize that formula. Try creating a mannual running total like this
whileprintingrecords;
numbervar i;
i:=i+@formula;
Now place this formula in group footer or header and suppress this formula. Create a new formula like
whileprintingrecords;
numbervar i;
Place this in report footer which shows the grand total.
Reagrds,
Raghavendra
Maybe you are looking for
-
How do I add more than one picture on a page?
I just started using Lightroom, and I want to know how I can add more than one picture onto a page to print or email. Right now, I will choose a picture, and it will make all of the pictures on the page that picture. I have even tried dragging a pict
-
Handling Events in Train Bean to perform validation
Hi All, I have requirement of adding validation logic on clicking 'Next' button in train bean. on Next button clicks validation logic works fine as expected but on Back button is causing the below exception. Not sure where is the issue? code used ins
-
okay, so i put my ipod in DFU mode to restore it. well now it is in the middle of restoring ipod software and the bar hasnt moved. what do i do?
-
i set the in preference check for updates weekly. but when i log in my account each time the update is checked. why?
-
Windows server 2008 r2 version 6.1 , erp 6.0
hi Experts, I need your help, I installed ERP 6.0 SR3 in windows server 2008 r3 version 6.1, but I have this error when I enter in the system Error text of the first reported error: "OS release Windows NT 6.1 7600 24x AMD64 Level 6 (Mod 44 Step 2) is