Suppressed Data being calculated on a count - crystal-reports

I am trying to get a count of records for a the Charge Group; however it is counting my suppressed data as well. I understand that suppressed data is only hidden and doesn't effect any calculation, but how can I adjust my formula so it doesn't take the suppressed data.
I attempted to do a running total field however I receive an error
A running total cannot refer to a print time formula Details: #Customer Drop Max Amount
Within the report there are multiple Trailer Charge Groups that are basically shippers and their destinations are marked as Drop Customers
I only want one record for two Drop Customers to be computed, so whenever another trailer falls into the record for Drop Customer I have to change the count field to show that their should only be one.
The formula field I am doing that for is Charge group count
IF {#TRAILER CHARGE GROUP} = 'INTCNEWNC' THEN Count ({TRAILER_CUSTOMER_ZONE.TRAILER_ID} , {#TRAILER CHARGE GROUP}) - 6
ELSE IF {#TRAILER CHARGE GROUP} <> 'INTCNEWNC' THEN Count ({TRAILER_CUSTOMER_ZONE.TRAILER_ID}, {#TRAILER CHARGE GROUP} )
I am using Crystal Reports XI on a DB2 server.
Thanks in advance!
edit: INTCNEWNC is the charge group, whereas ASHLADVNC and MARSBIVA are the drop customers. You can clearly see the individual counts for Drop customers are fine but the count for charge groups is where I am struggling.

1) Create running total fields for both the specific drop customer and charge group.
2) A formula field stating
IF CHARGEGROUP = 'MY CHARGE GROUP' then (rt.charge group) - (rt.drop customer 1) - (rt.drop customer 2) + 2 else count(trailer)

Related

Crystal Reports - Running Total is duplicating if a group has more than 1 "detail"

I have a report that I am trying to get working in Crystal. Basically the report is about gifts (I work for a non-profit). I grouped the report by Payment Method, and then Gift ID, which is a unique field in the .MDB file used to fuel the report.
I want to keep gifts with the same payment method together, which is why I first grouped by that. Then I grouped by Gift ID. the "Details" of my report is a field called Soft Credit Donor, which will list out as many donors that were given soft credit on the gift. There could be 0, there could be multiple...I show running totals in the Report Footer. I have a Gift Count (a Distinct Count of Gift ID, evaluating on each record, resetting Never), a Sum of all Gifts (a sum of Gift Amount, evaluating on Change of Field - Gift ID, resetting Never). These 2 fields work fine.
Then I get to where I want a running total based on each Payment Method. I am able to easily show the # of gifts per payment method. I do this with 4 separate running total fields (one for each payment method). I am doing a Distinct Count on GIft ID, evaluating on a formula (payment_method = "Business Check", "Personal Check", "Credit Card", etc...and Resetting Never.
My issue is when I try to do a $$ total for each payment method. In this case I am seeing that my running total is duplicating if there is more than 1 "detail" or soft credit donor. My running total field is doing a sum of the Gift Amount field, evaluating on a formula (payment_method = "business check", etc...), and I've played around with the Resetting. If I choose Resetting Never, then I am seeing the money being double or triple, etc...counted. Depending on if gift has more than 1 "detail". If I choose to reset on change of field and I set that to either Payment_Method or GiftID, I get a blank running total.
One thing to mention is that my MDB file has multiple tables that are all left outer joined to the main table which holds the Gift ID and Payment method fields. So there is a Soft_Credit table that holds the Gift ID field, along with the each name of the Donor who gets a soft credit. I'm not sure if that matters or not.
I'd appreciate any help!
You can put this in a formula:
If {payment_method} = "Credit Card" Then 1 Else 0
Use this formula as sum in the running total.
Use "on change" on the id field.
User "never reset" for the total sum.
You have to create one formula and one running total for each payment method.

Crystal reports - Can't filter on custom formula number field

Crystal reports don't let me use a custom count formula field to filter which transactions to show in a manager report.
I'm creating a Crystal report that team leaders are supposed to take out to see on how many occasions their employees have reported in sick. A record is only supposed to show if that person has reported in sick 6 or more times the last 12 months.
The report shows a record (a page) for each employee belonging to the managers organisational unit. Below the employee information is a subreport where I show the transactions from the salary/time system. Using select expert, I have filtered out the transactions that is supposed to show. I have then created a database field that count which day was 12 months back from today, and filtered so that only the transactions falling into this period shows.
My last problem is that I only want to show the record that has a minimum of 6 such transactions during the period. I created a formula field named #Antal ("amount" in Swedish) that simply counts the distinct number of dates in the "from"-date for the salary transactions I'm showing (since a change of law 2019-01-01 we needed to create a new transaction type, so some of the occasions after 2019 may have two transactions referring to one sick leave, thus I'm counting the first day of the period instead), DistinctCount ({P_LSTAT.P_SXXX06})
Now, the subreport has a new column with Antal (amount) that counts the amount of the desired salary transaction. I then try to use the selection formula to only show records where {#Antal} >= 6 but I get the following error:
This formula cannot be used because it must be evaluated later
Is there any other (better) way of doing this, or am I simply missing something?
For your selection based on {#Antal} >= 6 you need to use the group selection formula, not the record selection formula. Record selection is used to select records which meet the criteria before reading in the data. Group selection is used to filter out entire groups of records based on summarised values, after the records have been read in and the summaries calculated - which sounds like exactly what you need here.
The value of a Formula Field is out of scope when the Select Expert is evaluated.
There is no process for calculating the value of a Formula Field before it is printed within the section of the report it is placed. The Select Expert is evaluated prior to any section of the report being printed, so at this time all Formula Fields are effectively Nothing.

SSRS 2008 R2 - Group toggle aggregates

I'm working with a dataset where employee utilization is calculated as (Time Billed to X/Standard Billable hours). As such, to get the total billable percentage for an employee, I can just sum up the percentages billed to each client. However, I also want to be able to see the percentage of time billed by department.
I've currently got my data in a matrix with row groups Department-->Employee-->Client with 1 column group of "time sheet ending date". When I toggle the visibility of the client row group based on the employee row group, I get the correct totals at the client and the employee level. However, when I toggle the visibility of the employee row group based on the department row group, the department row group has the wrong totals. For example, if Department A has employee B with 90% utilization and employee C with 95% utilization, the toggled total at the department level is 185%....However, I am expecting to see 92.5%....any ideas????
You might just need to tweak the expression used to get the department total. I am unsure what expression exactly you used, but it should be of the form:
SUM(epmployeePercentageColumn)/COUNT(employeePercentageColumn)
obviously replace the "employeePercentageColumn" with whatever field or variable or expression that represents each of the employee percentages that come under the particular department.
If your current expression isn't in that form, try and tweak it.
Hope it Helps.

Groups being printed twice after page break

I have made a report that shows transactions in a certain time period for certain products.
To simplify it; its based off 3 tables: Transaction, Product and Customer. Transaction joins to Product and Customer by keys ProductID and CustomerID respectively. The product can be used by several customers though, so there is no join between customer and product.
The report is structured as below:
Report Header:
-Group Header 1 - CustomerID (prints name, id etc)
--Group Header 2a - Product Code (prints name, description..)
--Group Header 2b - sub report GetOpeningBalance
---Group Header 3 - Transaction Date
----Details (nothing printed)
---Group Footer 3 - Prints transaction date, details, new balance
--Group Footer 2 - Prints Product closing balance (opening - transactions).
-Group Footer 1 - Prints nothing.
Report Footer - prints nothing.
The sub report GetOpeningBalance calls a stored prodedure and returns a number in a shared variable corresponding to the opening balance. This is then incremented/decremented by each transaction and the closing balance is displayed at the end.
Now the selection formula is based on: Customer, Product and Date Range (to/from). Customer and Product can be discrete, range or discrete + range values.
This worked fine; it showed product transactions which occured in the range given and displayed numbers. The customer however wanted it to show all products; even if no transactions had happened in that time period. For example they had stock; but there were no intakes/outtakes so the opening and closing balance are equal.
So to solve this; I removed the date range parameter in the selection criteria (so it returns all transactions for the product) and have then supressed any detail lines that fall outside of the wanted date range. I have modified the running total formulas accordingly so they only include the "shown" transactions.
Now I am experiencing strange behaviour. Complete groups can be duplicated on the next page.. Say products 1-9 are printed on page 1, you would expect page 2 to start with product 10 and so on. However products 1-9 are printed; but then products 8 AND 9 are printed again at the start of page two . It prints the full section including the correct totals.
This behaviour is not consistent; it wont do it on every page or for every date range/product selection.
I have attempted ticking/unticking keep together in the Section Expert and the Group Expert. I have also tried removing some extra groups and details to try narrow it down to no avail.
Are there any options or settings that may be causing these groups to be reprinted?
I would usually use a subreport for the details section in these kind of problems; however because there is no direct join between product and customer it makes it impossible.
I had some free time to play with this today.
I found that switching the Group Header 2a with 2b; so that the subreport is before the product details header will stop this behaviour happening.
Now to test, test, test!

Crystal Reports - Total Count

looking to show an employee total on a report which has the following.
The report shows, by company divisions, count of employees to have had their annual assessment, I also wish to show total employee count per division so we would show
North Division - 50 employees had assessment out of 170 employees
East Division - 30 employees had assessment out of 50 employees
I cant seem to figure how to show the total count by division.
any pointers would be appreciated.
First of all; you need to group your data by Division.
You then need add a running total: Set it to count a a field displayed on each line (such as employee id). Then click in the "Evaluate" section - "Use a formula". Click the X-2 button to open the formula editor.
Your formula will be dependant on your data. You want it to output "True" for employees who have had their assement and false otherwise. [*]
Then in the "Reset" section, click "on change of group" and select your division group.
Now place your running total in the group footer of the division group.
[*] if this does not work, you will need to create a formula that outputs 1 or 0, on every line depending on whether the employee has had an assessment. Then create a sum on this formula to count the employees.
There are multiple methods of achieving what you want. Google "Crystal Reports Conditional Sum" for more answers.