How to summarize an if/then/else formula in CR - crystal-reports

I have a formula which calculates the commission earned by a salesperson. We store our invoices under each salesperson, so it's easy to separate them. I need a way to summarize this formula, and I can't use either a running total or a summary because each customer has a different commission rate per pound sold. Currently, the formula to calculate what rate the commission should be applied something like this:
if {cust.custnum} = "101010" then .0250*sum(#metal lbs, {invoice.invoicenum})
else if etc.
where {#metal lbs} is a formula that has to be used as an intermediary to get the weight of the metal on the invoice, and looks like this:
IF {INVOICELINEDETAIL.GLCode} = "METAL " THEN
{INVOICELINE.Wt}
ELSE
0
Sorry for the lengthy post, but I'm trying to give as many pertinent details as possible.

If you group by customer and then also group by invoice number then you could put your summary in the customer footer, would that work for you?
Another thought is I believe in running total you can set a formula for the evaluation so maybe you could use the nested if there and achieve what you need?

Related

Cognos Report Studio - Grouping/Filtering

Truth be told I'm not entirely sure what it is I'm trying to do here, well, that is I know what I want to achieve, but not how to go about it... so here's hoping you can help point me in the right direction!
I need to create a Crosstab report which has customers down the side, dates for columns, sales for figures. Simple enough.
Where it gets tricky is that they then want another row beneath the customers which singles out two customers, and their sales for one particular product.
They then want another row which will remove that figure from the total of the overall sales total for the first section (see example image).
I'm not really sure where to even start with this. I think I may need to use a query union, but every time I start I get kinda stuck... help!
That's not a crosstab. The summary calculations don't work. It's probably going to end up being three crosstabs formatted to look like a single crosstab. The first crosstab is everything down to the Total line. The last two lines are each crosstabs. Set the Size & Overflow, Padding, Margin, and other formatting properties so everything is layed out, bolded, and shaded the way you want.
You can create this as a crosstab
If you are okay with setting each customer as a fact
You can add them to a crosstab in any order you want
Then you can create a new data item and use a conditional statement that sets the metric to be the specific customers the consumer wants
For example,
IF([Customer] IN(?PrmCust) Then([Sales])Else(0)
For the revised total, unlock the report and replace them with layout calculations that take the total and reduce it by the amount of the selected customers

Need to Display Information that Has Been Sorted Out

I am still rather new to Crystal Reports and have what feels like a pretty basic question. I work at a school, and part of my duties are to help with donation reporting. My boss wants a report that gives her biographical(irrelevant to this) information about donors that gave 500 or more to our Booster fund(relevant).
The kicker is this: After using record select to sort for donors who have given more than 500 to this fund, I need to show how much they have given to other funds as well. The way I've tried to do it has given Crystal parameters to only display the data if giving exceeds 500 to booster fund. Here's the record select:
{gift.fiscal_yr} = 2015 and
{gift.campaign} = "Booster" and
{gift.amount} >= 500
After it runs through that, when I put {gift.campaign} on the actual report, it only shows "Booster", and not any others. I want it to show me the giving amount of all funds only if the donor has given 500 or more to Booster.
Thanks in advance for your help! This community is a life saver!
Off the top of my head try this:
Take booster out of selection formula as suggested.
I assume you are grouped on donor?
Create a formula #findboosterdonor
if {gift.campaign} = "Booster" then 1 else 0
Go to Report-Selection-Formula-Group
enter this with your field names
sum(#findboosterdonor,{donor}) > 0

crystal report group on multiple criteria

This is a strange scenario that I'm having trouble working out:
I have a report that needs to show the summary of donations that each board member gave/got in any fiscal year. They get credit for hard credit donations, soft credit donations, and solicited donations. Meaning their record ID number is in 3 columns throughout the spreadsheet.
So, my data looks like this:
Soft Credit ID/Hard Credit ID/Solicitor ID/Gift Amount
1/-/-/$50
-/1/-/$100
-/-/1/$250
I need to be able to group these records together because they each have the ID # "1" in the record (but in a different column each time). I need to group these records together, so that it shows the summary for each board member, with the details below:
Board member ID 1: Total Giving $400
Soft credit - $50 - 4/1/13
Hard Credit - $100 - 3/29/13
Solicitor Credit - $250 - 7/2/13
(^These don't need to be summaries, this just needs to list all gifts and which kind of credit they give)
I'm having trouble because I don't see a way to group based on the ID, in different fields. I tried grouping based on a formula for each board member (formula read {Hard Credit ID}="1" OR {Soft credit ID}="1" OR {solicitor credit}="1") but it didn't work and it creates a hierarchy that I'm not looking for. Apologies for the formatting - I can't find instructions on how to make that block above appear as a table.
One way to do it, depending on your source DB, is to use a SQL Expression to condense the three fields:
coalesce({table.SoftCreditID},{table.HardCreditID},{table.SolicitorID})
Or you can do it in a regular formula:
if not(isnull({table.SoftCreditID)) then {table.SoftCreditID}
else if not(isnull({table.HardCreditID})) then {table.HardCreditID}
else {table.SolicitorID}
Replace nulls in the three fields with 0 and then concatenate. You will then have a possibility of three values in the new field: 100 010 001
If you concatenate the three ID fields into a new field without replacing the nulls then you will get "1", "1" and "1". If you replace the nulls with 0, then you will get "100", "010", and "001". Now, you can group-by on the new field and you will get subtotals, or skip-group-by and just list the detail. To extract the description of the code, if we are only talking about 3 possible values, you can use nested if statements to examine first value and test if it equal to "100", else test if equal to "010", else test if equal to "001", else error. Or a case statement, syntax examples here: Select/Case in Crystal Reports or Crystal Reports SELECT CASE statement

Crystal Reports 2008- How do I get the median of a summarized field?

I need a way to work around Crystal's inability to summarize a summary.
Data Sample:
Shipment Number and Sum of $ Paid:
shipment #1 $1089.34; shipment#2 $985.22; and shipment #3 $1002.87
I have grouped my data by Shipment Number and summed the $ Paid for each shipment. Different deliveries were on each shipment so I had to sum the $ Paid to get the total amount paid on each shipment. Out of this list of sums, I need to find the median. I know this would be easy to do if I exported to excel, but I need to have it built into the Crystal Report.
I know writing a simple formula such as median(sum($paid)) does not work. The error message "this field cannot be summarized" confirms that Crystal does not have the ability to summarize a summary.
Please help! Any work-arounds are greatly appreciated.
You can achive this by using Running total.
Take running total for paid and another running total for count then use both in a formula to find the median.

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.