How to find percentage by group in crystal reports? - group-by

I am using crystal reports plugin in visual studio to develop crystal reports.
In my report, there are three group by functions. The hierarchy is shows below -
Employee.EmployeeType
Employee.EmployeeCity
Employee.OfficeBranch
I need to calculate percentage of Seats occupied in every branch per city. The condition is that only those seats should be considered that have seatnumber greater than 5.
I am using the following formula but it is giving me error saying ) expected -
#seatNumber
if({Employee.SeatNumber},{Employee.OfficeBranch})>5
then
count({Employee.SeatNumber})
else
0
I know we have to use if ({key field}, {Group field}) and then we have to create another formula which we will use to sum(#seatNumber).
and then will have to use both to calculate percentage per group. But I am stuck.

if({Employee.SeatNumber},{Employee.OfficeBranch})>5
is not a valid expression.
You probably meant something like:
if {Employee.SeatNumber} > 5

Since you wish to ignore seats 1-to-5 it would be a lot simpler to just add this condition to the record selection formula:
{Employee.SeatNumber} > 5

Related

Crystal Report how to change the display order in a group

I have a crystal report like below image:
The report is group by "Quot No.", by default it's ordered by "Times Used" (8th column)
How can I change the ordering so that it will order by "Total amount"?
The total amount is a field in the report which is the sum of a field named "quotamt" in the datasource:
I've tried looking in the change group options, took a look at the "Use a formula as group sort order", but the formula only provides three options (ascending, descending, original order), and is unable to sort by another column
The desired result is:
How can I do that?
What I suggest, rather than doing this task in crystal report, good to done at sqlserver side means database side.
This is simplest suggestion when you have this type of situation.
You can give the condition on sqlserver side too. and get the data order same as you want.
Yes, this can be done in report side, but it take time for this.
Don't use formula as group sort order instead from the dropdown use Specifed Order and in the window specify the order you need

Crystal Report: Get Minimum Date

I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/

Crystal Report-Running Total

I have a problem with running Total in Crsystal report9
if their is no values available for a Paticular field how can we return the running total as '0'
Instead of display the Running Total directly in your report create a Formula Field based on the Running Total and drag it into the report.
Your formula should look like this (Crystal Syntax)...
if ISNULL({#RunningTotalField}) then
"0.00"
else
ToText(RunningTotalField, 2)
If there is no data for that particular group, then Crystal won't show it easily. Your options are :
1) Use subreports to display the values for a particular group, and keep the main report just looking at the table(s) containing the group headers.
2) Use a stored procedure as the source so you have full control over the SQL that is run.
The problem is that as soon as you use a field to group, Crystal will only return records where that field has been used. If it was simply in the Details section you could modify the link to a LEFT JOIN and it wouldn't matter, but the group forces the INNER JOIN which means the groups without data are not returned.
Unfortunately Running Totals don't show up if there are no records that match your criteria. An alternative is to use a set of formulas calculated in various sections of the report. The technique is widely described in the Crystal literature. For example, this TekTips gives a very succinct overview of your options.
You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.

Crystal Reports: Is it possible to sum for more than one column?

I work on an accounting project in .NET.
I want to sum all transaction and its opening balances.
I use summary but it Allows only one column..
You can summarize within formulas, so long as the formula field is present in the report footer. When using Sum() CR knows to evaluate the expression for all records returned.
So you would create a formula for the report footer, and the formula code would be something like:
Sum({#TransactionAmt1}) + Sum({Transactions.Amount}) + Sum({#AnotherFormula});

Conditional group SUM in Crystal Reports

I've been doing some accounting reports and have been summing up my different currencies using a formula
IE
CanadianCommissionFormula
if {myData;1.CurrencyType} = "CDN" then
{myData;1.Commission}
else
0
CanadianCommissionSum
SUM({#CanadianCommissionFormula})
Then I'd just display the CanadianCommissionSum at the bottom of the report and things were great.
I've just come across the requirement to do this, but grouped by Sales Rep. I tried using my previous formula, but this sums for the whole report. Is there an easy way to sum like this, based on which group it's in?
You probably figured this out a year ago, but just in case, try this:
Change your CanadianCommissionSum formula to
SUM({#CanadianCommissionFormula},{SalesRep})
Put this formula in your SalesRep's Group Footer section.
This should now display properly.
Create a group based on the sales rep in the Crystal Report, and place the:
SUM({#CanadianCommissionFormula})
...in the footer of the group.
I would assume that rexem's suggestion should work but since you said it gives you a total all of the sales reps you could change the sum to running total. Before doing this I'd double check that you have your field in the correct footer section though.
To do the running total, group by Sales Rep, and then set up your running total to evaluate on every record and reset on the change of the group. Then you can put this running total in the group footer and it will show subtotals.
Hope this helps.