Grouping the Details in Crystal Reports - crystal-reports

I am not much familiar with Crystal Reports. I facing one issue regarding the Detail fields in Crystal report.
Lets assume I have 5 fields in Details band.
Field a, b, c, d, e and the record set for the below fields will be as below
A B C D E
111 1 20 30 222
111 1 21 31 222
111 1 22 32 222
111 2 11 11 222
111 2 12 12 222
111 2 13 13 222
Now I need to display the details by grouping the field B and get the sum for C and D. And at the end my result should be as below
A B C D E
111 1 20 30 222
21 31
22 32
------- ------
Total 63 93
111 2 11 11 222
12 12
13 13
------- ------
Total 36 36
Can some one help me how do I do this kind of Stuff.

You should use the group option (Insert --> Group) and select field B.
Then, use running total to sum the wanted fields. (View --> Field Explorer, then, on the field explorer right-click on 'Running Total Fields' --> New). Create the wanted running total using this expert and then drag into your report in order to show it.
Insert text boxes as needed for the caption of the group header and "Total".

Urik is correct !
I just want to add some points as par the output user1464855 want.
Add groups for two columns field A , field B . add these fields in the detail section also add the C, D and E in
the section.
To display Total you can use either of the following ways
a. you can add new "Running Total field" for Columns C and Column D as Urik said.
b. you can right click on the field "C" and select "Insert --> Summary" then select the field "C" select the "sum"
and select the summary location "Group # 2" in "Insert Summary" dialoge box and click "OK".
To avoid displaying the duplicate values (repeatation of values) select the field on the report e.g. field "E"
right click on it Select "Format field" select "Common" Tab select check box "SUppress of Duplicated".
you can repetae this step for other fields A, B.
I hope this will help you. kindly correct me if I am wrong !

Related

Tableau: Return Top N departments for sites according to maximum sales value

Hi So I have a table where I have data like this
Site Dept Sales Orderno
Site1 D1 100 1
Site1 D1 200 2
Site1 D1 300 3
Site1 D2 1100 4
Site1 D2 2200 5
Site1 D2 1300 6
Site2 D3 1100 7
Site2 D3 2200 8
Site2 D3 3000 9
Site2 D4 1000 10
Site2 D4 2000 11
Site2 D4 3000 12
So for e.g. here i want to see only the top N dept for each site according to sum(sales)
N=1 here , but need a generalised formula of sorts since N can be anything
For site 1 , dept 2 has more sum(sales ) and for site 2 dept 4 has more sales overall , so only those should be returned in a line chart. How to do this
That's a tricky one (at least for novices like me)
Steps-
Add calculated field named 'Index' as
INDEX()
Change this calculated field to 'discreet'
Add Site, Index and then Dept to rows, and Sum of sales to visualisation
Right Click Index (field) --> Edit Table Calculation --> Click 'Specific Dimensions' in 'Compute using' --> select 'Site' from drop-down of 'restarting every' option --> under 'Sort order' click 'custom' --> select 'sales' and 'sum' and descending respectively --> click OK (Cross above)
Control and drag Index to Filter. Click OK
Change index filter to continuous (by right clicking it)
Select your 'N' as desired
Optionally drag Site pill to Colors
I think this is the view desired.

How to create a filter for columns in a dashboard?

I have a table which looks like this
id login_id trend_type sep oct nov
1 abc#abc.com Billing 10 34 43
1 abc#abc.com Visits 20 43 56
1 abc#abc.com Revenue 30 12 12
1 pqr#pqr.com Billing 40 23 54
1 pqr#pqr.com Visits 50 21 47
1 pqr#pqr.com Revenue 60 98 12
I want to create a dashboard where I can display graphs of all these Trend Types and add a filter for the user so they can select the month for which they want to view the graphs.
I have tried this solution -
https://community.tableau.com/thread/228965
but I wasn't successful.
Tableau really likes data that is taller rather than wider. In this case, you need to do a PIVOT on the month data. A pivot will create a column for the months and another column for the values. Your data will have more rows now but fewer columns.
When you bring the data into Tableau, on the Data Source screen, highlight the three month columns and select pivot.
You can also change the name of the Pivot Field Names (to Month) and Pivot Field Values (to Amount or another appropriate name).
Click on the orange Sheet 1 on the bottom left. Next, create a calculated field to create a full date. (Tableau doesn't know what 'sep' is.)
[Pivot Field Names] + "-01-2019"
This field just creates a string that Tableau can parse (eg 'sep-01-2019'). Now tell Tableau it is a Date field by changing the field type (click on the Abc next to the Dimension name).
At this point, you can create a viz and add filters. Here is an example.

RT not summing for group

I have to suppress duplicate details and have created a manual running total including the suppression formulas by group. The issue is I have three receivings with the same item, same date, same location but different receiving numbers (not duplicates); which do appear on the report. I must use previous and next functions to have a correct running total of the detail where the duplicates are suppressed but where there is three groups (same item) the center group shows a RT of $0. I have tried "or" instead of "and" but then the groups with duplication show incorrect running totals. I have tried previous only but that also present incorrect running totals. Any suggestions?
Example
Grp Receiving# Date Item# Running Total
1 222 Nov 21 789 $200
2 333 Nov 21 789 $ 0
3 444 Nov 21 789 $200

Group Summary Involving dividing in Crystal Reports

I have a Crystal Report with about 9 different groups and wanted to be able to have a summary that involves dividing one value by the other.
For example (table):
Period Company Division Region State City Store Employee Sales Goal
01-2012 Ab Works Northern NW OR Ball 888 Foo 100 150
01-2012 Ab Works Northern NW OR Ball 888 Choo 175 120
02-2012 Ab Works Southern SE GA Chip 743 Bar 34 75
02-2012 Perrywee Northern NC MN Fedd 147 Bill 80 64
03-2012 Perrywee Eastern FE WV Wood 98 Tim 75 250
01-2012 Perrywee Eastern FE WV Wood 92 Karl 84 250
01-2012 Perrywee Western W CA Fub 398 Fubar 175 170
My output then looks like this:
Company Jan2012 Feb2012 Mar2012 ... YTD-Avg
Ab Works 70.3% 87.3% 87.5% 84.3%
Perrywee 93.5% 97.3% 130.3% 90.4%
Each will allow drilling down to the group below it and the value is calculated by the sum of sales for the group divided by the sum of goals for the group. As there are 14 periods and 8 groups I want to avoid having to create ~115 formuals.
Is there an easy way to accomplish this?
I've done something similar but not using Percentages. The way I thought it out is almost painful to do, but you will have drilldown capabilities. I'll post what I've come up with but if someone can modify this to make it easier, by all means.
First, create the 8 groups you want use and hide them. You will need 14 formulas to create columns for your periods. For your first period, the formula (and following periods) should look like this:
IF {table.period} = "01-2012" THEN
IF DrillDownGroupLevel = 0 THEN
SUM({table.sales}, {table.group1}) / SUM({table.goal}, {table.group1})
ELSE IF DrillDownGroupLevel = 1 THEN
SUM({table.sales}, {table.group2}) / SUM({table.goal}, {table.group2})
ELSE IF DrillDownGroupLevel = 2 THEN
SUM({table.sales}, {table.group3}) / SUM({table.goal}, {table.group3})
ELSE IF DrillDownGroupLevel = 3 THEN
SUM({table.sales}, {table.group4}) / SUM({table.goal}, {table.group4})
...
ELSE
SUM({table.sales}, {table.group8}) / SUM({table.goal}, {table.group8})
ELSE
0
What this formula does is identify what period it is, then determine what group level it is on. It then Sums up the Sales and Goal considering what the group is suppose to be on that level.
For line IF {table.period} = "01-2012" THEN, I'd set up as a parameter so it will work for multiple years.
I would rather use a function to determine what group level I was on, but all I know is DrillDownGroupLevel. It is useful but flawed if you try to do something fancy with the groups (conditional surpression) don't do a simple drilldown.
Change {table.group1} to what ever field you used for that group level. i.e. {table.company}
A drawback on this formula is every time you drill down, the DrillDownGroupLevel will change. The new level you reveal will be correct, but previous levels that still show will change.
Hope this helps.
Steps:
insert a cross-tab; company for row totals; period for column totals (set group options to 'for each month'); add sales and goal to summarized fields
preview report
right click a goal cell, select 'Embedded Summary', then 'Insert Embedded Summary'
switch to design mode (cross-tab expert); ensure order (top to bottom) of fields are #Embedded Summary, Sum of Sales, Sum of Goal
go to preview mode; right click Embedded Summary field and choose 'Edit Calculation Formula'; add the following:
local numbervar n:=GridValueAt (CurrentRowIndex, CurrentColumnIndex, 1);
local numbervar d:=GridValueAt (CurrentRowIndex, CurrentColumnIndex, 2);
if d<>0 then n/d*100
suppress the sales and goal fields
I haven't (yet) found a way to remove the extra space, however.
Sample:

Group is created to the right of Parent

I cannot figure out for the life of me how to add a sub group to a parent group but to have that sub group sit below the parent group row. Right now if I right click the parent group and add a child group..it adds a child group but to the RIGHT of the first parent group's cell in the report.
Anyone?? How the heck do you get child groups to sit below the parent row?
For example my report will have a parent group that holds a CarType
For each Car Type group, it has several related car names
------------------------------------------------
Honda
Field1 3 4 54 534
Field2 5 3 44 455
------------------------------------------------
Accord
Field1 53 3 43 222
Field2 5 22 24 423
Pilot
Field1 4 3 5 221
Field2 5 27 24 423
..... rest of the car types for honda
------------------------------------------------
Toyota
Field1 3 4 54 534
Field2 5 3 44 455
------------------------------------------------
Camry
Field1 53 3 43 222
Field2 5 22 24 423
xxxx
Field1 4 3 5 221
Field2 5 27 24 423
..... rest of the car types for camry
and so on. So we don't want the children to be indented (I'm not sure if this is now not going to be stepped or what..that's what I'm having trouble with cause every example out there on the net shows you how to do a stepped report but shows the the child group indented in a little which we don't want for x business reasons.
I can't get this parent/child set of rows to look like this in the report. I want nested (parent/child) but child should be starting flush left, not indented in relation to the parent when viewing the data.
Here is an example in another report and you can see the groups stacked:
another example in another report
There's probably more than one way to do this, but I'll explain this way to keep it easy to follow.
Start with a table, and add your child group to the first column in the details row.
Right-click that cell with your child group, point to Add Group, and then click Parent Group in the Row Group section.
In the Group By drop-down list, select the parent group and select the Add group header check box, and click OK. Another column gets added to the left of your detail group and the Row Groups pane now shows the parent group and child group. A new row appears between the table header and the child row (details row)
Delete the new column.
Add the parent field to the first column in the row above the details row.
Quick, albeit non-intutive, fix for adding a new Parent Group after the tablix has been created:
Add the Group in the groups section.
A new column to the left will appear and probably mess your beatiful layout. Don't leave that new section just yet.
Right-click and insert a new Row.
Mark that new row by writing something on it (i.e. "This is Parent 01")
Right-click the newly (and undesirable) "left grouping column". Delete it and be careful to just delete the column, NOT the associated group level.
VoilĂ ! Now you have a new Parent Group and a place where to put things in it, like a new group title, aggregates or whatever you fancy.
Hope it helps!
If, not drop a line.