Crystal Reports Crosstab Summary Row Count of Subset of Data - crystal-reports

I have a crosstab report that counts the instances of records (that I have previously filtered via the Section Formula Record method).
I would now like to also include a second count of the records that are a subset of the original set of records.
IE In my booking app, I have a count of all the booked seats in a restaurant, I would now like a count of all the seats that were booked online. (and of course this is all grouped by restaurant at the top and then each row is the day.
I hope that makes sense, - thanks in advance.

Create a formula such as IF <Booked_Online> Then 1 ELSE 0
Then, SUM that formula to get the count of booked online.

Related

Filemaker: display related records based on date

I have 3 tables,
Table 1:
Client
Table 2:
Followups
Table 3:
Referrals
It's a one to many relationship where one client can have multiple followup or referrals.
How do I display the Followups and Referrals between 2 dates?
I have a summary field which counts the total of each followup and referrals but they show me all the count rather than in between a given date
In your relationship graph make a new table occurance that restricts the related set based on a date range. Here is an example image. You can make "date one" and "date two" globals so that they are not stored, and operate across all records. Base your sum / count calcuations based on this relationship.
Otherwise you can use a sub-summary on your layout in list view, and place the Summary fields in the sub summary. The summary field will show the sum for that sub section.
Another option is to place the summary field inside a one-row portal and filter the portal to show only records within the desired range.
This requires much less resources than adding filtered relationships - but it can be slow if you have too many related records.

Suppress records in grouped section between first two and last records in Crystal Reports

First, I am using Crystal Reports 2011. I need to suppress records in a group that fall between the first two records and the last record. In other words I only want to see record number 1 and 2 and the last record. I can easily suppress records that are not the first two, but getting the last record to not be suppressed has me at a standstill. I am creating a report where we want to only show the first, last and next-to-last time we purchased items. Some items have been purchased many, many times. I have the report grouped by part number, then all the dates we purchased the part (and other data) are in the group details. I have tried using a running total count, where I simply suppress details that are not 1 or 2, but the last record count varies depending on how many times we have purchased the item, so I don't know what the last count number will be for each group to use it in the suppress formula. I have also tried with declaring a variable and increment the variable for each record, but end up with the same problem as using running total count. Anyone have a suggestion?
To clarify my question a little further, I am sorting the group by date, most recent date first. So record count 1 is the last time we purchased and record count 2 is the next-to-last time we purchased. So by using record count I can suppress records that are not 1 or 2. The problem comes when trying to figure out how to not suppress the last record (which is the first time we purchased). Below is a link to a pic of what my report looks like with nothing suppressed. For this part I would want to suppress all records except 1, 2 and 5. But again, the last count number will change per part number depending on how may times we have purchased the part.
Help is greatly appreciated!!!!
Report cropped image
Using Crystal syntax you can test on OnLastRecord which returns true if you are on the last record or false if not. Simply suppress accordingly.
EDIT:
As pointed out by jmears, the above won't work for multiple groups of differing products.
Instead you can add a running total field to count each record within the group, reset on change of group. Then suppress the details based on the running total not being 1 or 2 (for the first two records) and not equal to the total count of records for the group.
Here's an example suppression formula, where {#rt} is the running total count of records. It uses the Count function to return the total count for the group
not({#rt} = 1 or {#rt} = 2 or {#rt} = Count ({fieldToCount}, {GroupField}))

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.

How to detect if a table has rows in crystal 2008

Is there a built in crystal method to detect whether the a table in a crystal report has any rows?
I have created a sub report which has some Title text in the header and a detail line with the table info.
I want to be able to supress the title text from printing if there is nothing to print.
Also, is there any way to pass this to the "master" report so that I can suppress printing the sub report completely if there is nothing to print?
Regards
Use Count() function.
Use it with one of your data source fields.
from Crystal Reports 2008 Help:
Overloads
Count (fld)
Count (fld, condFld)
Count (fld, condFld, cond)
Count (x)
Arguments
fld is any valid database or formula field that can be evaluated by the function.
condFld is a field used to group the values in fld by.
cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions .
x is an array of values that can be evaluated by the function being used.
Returns
Number
Action
Enables you to count the values that appear in your report (for a specified field). For example:
If a sales report includes all orders made and the amount of each order, you can compute the total number of orders that appear on the report (a grand total count).
If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the number of orders per group (in this case, per state).
If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the number of orders per group based on a particular change in the date or Boolean field (in this case, per month).
If you specify a set of individual values, you can compute the number of values in the set. For information on this kind of counting, see Array summary functions .
Examples
The following examples are applicable to both Basic and Crystal syntax:
Count({orders.AMOUNT}, {orders.CUSTOMER ID})
This formula counts the number of orders in each group of orders in the Amount field (the total orders for each customer). The orders are separated into groups whenever the value in the Customer ID field changes.
Count({orders.ORDER AMOUNT}, {orders.ORDER DATE}, "monthly")
Counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.
The following examples are applicable to Crystal syntax:
If Count({orders.ORDER ID}) >= 100 Then
"Congratulations on meeting your quota!"
Else
""
Prints the congratulatory message if the number of orders is 100 or more, and prints nothing if the number of orders is less than 100.
Count([1,2,3,4,5])
Returns 5. Counts the total number of values in the array.
Note: Using this function in a formula forces the formula to be evaluated at print time.
For more information on evaluation time considerations, see Evaluation Time.