Display only records exceeding four items - crystal-reports

My Group Footer shows the number of distinct items bought by each customer:
Cust Ref, Items bought (distinct count)
001, 4
002, 12
003, 6
004, 3
How can I display only the customers who have bought 5 or more distinct items?
I tried using distinctcount(items bought) > 4 but it looks at all the distinct items bought by everyone, not each individual customer. What formula should I use and where?

You have to place a group by CustRef, then at the footer place the CustRef and a formula named #DistCnt containing (DistinctCount({ItemsBoughts})) (It seems you've already done that)!
Then in the Section Expert section click on the (x-2) button near the suppress checkbox related to this group footer and write: #DistCnt < 5 and save.

Go to section Expert and then go to suppress write the below code and save
Cust ref <5

Related

How do I create a Group Total from an existing group in Crystal Reports

I have a Crystal Reports that has several Groups as noted below. I need to return a total for each Customer Group by the items (I could have 6 invoices that have Item 1 - 3 on each)I want to see a total for each item - rather than seeing 18 lines - just 3 aggregated by Item
Group1 Customer
ABC001
XYZ002
DEF001
Group2 Invoice #
017700
017702
017703
Group3 Details from Items on Invoice (I needed this to load in taxes to Sales & COGS)
Item 1
Item 2
Item 3
Insert a CrossTab in GH1 or GF1 that shows totals by Item.
note: could also be done with a subreport, but CrossTab is easier and faster.

Tableau Insert Customized Rows of Subtotals

I have a data set with 13 rows, each representing a product type. Those 13 products then divided into 3 groups (an image of the data is attached below),
the first 7 products are in Group1
the next 3 products are in Group2
the last 3 products are in Group3
My task at hand is to insert a row that gives the subtotal of the first 7 products (i.e., Group1 in the table), then another row that gives the subtotal of the first 10 products (i.e., Group 1 & Group 2), and the grand total (i.e., all 3 groups). The first subtotal row should be inserted after Group1, and the second subtotal row should be inserted after Group2.
Any advise of how to achieve this would be greatly appreciated!
In the Format tab of menu bar select totals -> add all subtotals
FORMAT -> TOTALS -> ADD SUBTOTALS.

Group items based on a formula

I am creating an invoice using Crystal Reports & I want to group products which have the same PRO_ID into one line, for this I have created a GROUP and it works fine.
Following is a sample of the data
PRO_ID NAME ORDER_QTY
0001 Battery 2
0001 Battery -6
0001 Battery 3
In the second line the quantity is a minus because of a returned item. I want to show the actually ordered items separately & returned items separately.
At the moment the report shows -1 for the ORDER_QTY because it just groups the Products based on the PRO_ID. How can I group these separately ?
try this:
Keep PRO_ID as it is as the first group and then create a sub group #group2 and write below code:
if ORDER_QTY<0
then "Returned"
else "Actual"
Use #group2 to group after PRO_ID.
Now place the all your fields in details.
hope this helps

How to select a specific record/row of data in Crystal Reports?

I have my sql database Views available to my report, but sometimes they return multiple values, for example I have one that shows me the Total Credits for a range of years.
When I click "Browse Data.." it lets me see what bits of data are available
Eg:
Credits
-------
31
45
460
But I want to select 45 (based on a customer ID)... is it possible to do this?
EDIT: An alternative is if I can link the Customer ID from two views, but only if it's not null (as sometimes there are no records in the Credits)
To avoid the problem of unintentionally "deleting" customers from the report results, first do a left outer join between the CONTRACT_VIEW and the year views, such as TOTAL_2013. In your selection formula, instead of just doing something like {TOTAL_2013.Customer_ID}=MyCustomerID, add all the nulls to it as well, so: isnull({TOTAL_2013.Customer_ID}) or {TOTAL_2013.Customer_ID}=MyCustomerID. This will prevent customers who don't have any entries in the by-year views from being removed completely from the report.

Crystal reports - running total for specific groups

I have 4 groups and I only wanted to have running totals for 2 of them and show the total after the second group. Is there a way to do this?
Group1
DetailsA
records...
Group2
DetailsA
records...
TOTAL - SUM(records)
Group3
DetailsA
records...
Group4
DetailsA
records....
There are a couple of ways of doing this:
(1) Set up a running total to sum the appropriate field - add it to a group footing section which is suppressed where the group is not group2.
or
(2) Add a higher level of grouping on a formula set to 1 for the existing groups 1 and 2, and as 2 for groups 3 and 4, then add a sum of the appropriate field to the group footing section for the formula group (which should be suppressed where the formula is not 1). To do so:
add a new formula field called TopGroup (for example).
give it a formula like:
if {TableName.GroupField} = Group1 or {TableName.GroupField} = Group2 then 1 else 2 (substituting actual Group1 and Group2 values as appropriate).
Insert a new group on TopGroup. You will probably find that this is now the lowest level of grouping - open the Group Expert to make it the top level of grouping.
Right-click on your new Group Header #1 and select Suppress.
Drag and drop the field you want to sum into your new Group Footer #1. Right-click on it in the footer and select Insert > Summary... , select the appropriate summary operation (probably Sum) and Summary Location as Group #1, then click OK.
Drag the new summary field off the top of the field it summarised in the Group Footer #1 section, then replace the unsummarised data field with an appropriate text field - eg. Total: .
Enter the Section Expert, and set the Group Footer #1 to be conditionally suppressed where {#TopGroup} <> 1 . If you now preview your report, you should see the desired total between the end of Group2 and the start of Group3.
If it turns out you are likely to need to display the running total elsewhere in the report then I would suggest the first method, otherwise I personally would prefer the second.