Crystal Reports 2 column crosstab - crystal-reports

Using crosstab expert in CRpts, populating the columns selection with 2 column names and using preview, report has I cannot tell what is what. Report has helpdesk total by date and out of that total there is a group count for another dept. Report looks great with one column selected. However, once I select a column fr db and select it to the columns with Crosstab expert, the columns in the report preview are displayed but hard to tell what is what since I get No and Yes columns. I also have Keep Groups together, column totals on top, and Row totals on left "checked" out.
I want to be have: grand toatl column(for helpdesk) total for Dist. Classrooms afected totals
Can you help? I am also new to CR and have not been able to make a "hit" researching.

Based on the above, I want a report to look like:
(col 1) (col 2) (col 3
Date Group District Classes Affected
Crosstab expert has: 2 rows, 2 summaries(sum on date and grandtotal on top), 1 col(which works great with only col 2 used as column but not when I include col 3).
District is count of district's in group
Classes Affected is count of groups count.
Is this better?

Related

Reporting a count in 2 different tables

I'm working in a Crystal Report that someone else created. In the report I want to count the total number of days someone is absent. The statement below is what is currently in place.
(select count(*) from attend_day inner join absencetype on name=attend_type
where GRP='Absent')
However it isn't giving me the correct number. it gives me some outrages number like 1,500. The table I'm working with are Attendance Table.
In the Attendance Table there is ATTEND_TYPE which is Attendance entry for the student and I want to total the number of days that have the word Absent in them. There are 2 values Absent - Excused and Absent - Unexcused.
Any suggestions?
Try writing a formula called "Absent":
iif(Attendance.ATTEND_TYPE like "*absent*", 1, 0)
Then insert a summary that takes the SUM of #Absent

how to count row in crystal report

I've got data as picture below, i'm using crystal report to display statistic report from that data.
i want to count MRN which got 2 until 5 rows of episode number only.
currently im doing
1) group MRN in crystal report and count(episode number).
2) create 1 formula like :
if count(episode number) >=2 and count(episode number)<=5 then count(episode number)"
3) put the formula to report and try to insert summary to count that formula, but no selection summary appear for that formula.
Can you give me an idea how to count MRN with 2 until 5 episode only? refer to picture for clear explanation
In Crystal you can use two condition types to sort which records are being showed:
Record selection formula
Group selection formula
Both are located in the menu Report > Selection formulas
In your case you can define a group on field MRN and create a Count field inside that group. To show only groups where the count is between 2 and 5, use the Selection Formula > Group condition in the Report menu.
Count ({EpisodeNo},{MRN}) <=5 and Count ({EpisodeNo},{MRN})>=2

crosstab report how to calculate specific columns values and subtract from row total

am stuck at a point that in Crosstab report, i need to have sum of only two column's value and subtract the total by the value what should i do?
as in below,
Product 1 Product2 Product 3 Total
----------------------------------
Cust 1 4 5 2 11
Cust 2 5 9 7 19
I want to sum values of "Product 1","Product 3". then subtract from row total=> Total
LIKE
[4+2]-11=>TOtal.
and want to repeate this for each customer..
anyone please help me out.
I'm not sure when embedded summaries were introduced but I am pretty sure that your version of Crystal has this functionality. If not I apologize ahead of time. I have only been using this method for a few months now and it is quite confusing at first. At least to me but it has come in quite handy.....
I am making the following assumptions about your crosstab. Make name changes as you need to
row {yourtable.CustID}
Column {yourtable.product}
summarized field {yourtable.cost}
In the top left of your crosstab, right click go to advanced calculation and select calculated member
Select New and enter a description
For Type: Select Column
For insert Evaluation: Select After
Click edit insertion value and enter
CurrentColumnIndex=(GetNumColumns-2)//This will insert a column just before the total column
Click edit header formula and enter in quotes what you want to call the column
Select the content in Value Formulas then click Edit Value formula and number value
Save and close then exit the calculated member expert
Your crosstab should now have a new column
Right click the value go to Calculated member and select edit calculation formula
Enter this formula
(
GridValueAt (CurrentRowIndex,0 , 0) // Product 1 value
+
GridValueAt (CurrentRowIndex,2 , 0) // Product 2 value
)
-
GetTotalValueFor "yourtable.product")
NOTE: Geez it is hard to post on this site!
well after thinks long on it I've have done......
1st be clear that crystal report 10 is not offer following function
"CurrentRowIndex", "GridValueAt"
 
that's why above solution by "CoSpringsGuy" is not applicable.......
as we have two tables. 1 customer and 2nd for products and by both we generate crosstab with summarize field of product_sold (Qty) and 2 crosstab columns “Product.name”  and sub column product. Type
Now we want to sum value under the product.packing type =”Pilot”  of  product sold to each customer and subtract the sum-up from grand total of all products (product type “Normal” and “Pilot”)
For this problem 1st we have to work on formatting formula at crystal runtime and manipulate to “Display string” of summarize field
And then we will edit totals i.e very last column
1st edit summarize filed “display string” with the help of following code
Global CCust As String to keeping last customer for teli new customer name
Global Ccol As String ' tht is for keeping last column/product.packing type and teli with new col
Global Rndx as number ' this is for generating index of the row
Global totperx(22) as number ' is to hold the currnt value of cell and adding with previous value
' and i imagen that number of customers will less then 22 otherwise you can take unlimited array
Whileprintingrecords
if (CCust="") then
CCust=gridrowcolumnvalue("Table_Cust.Name")
Ccol=gridrowcolumnvalue("Viw_Prod.Packing")
Rndx=1
formula="new"
end if
if CCust<>gridrowcolumnvalue("Viw_Prod.Packing") then
formula="same"
Rndx=Rndx+1
else
formula="Newag"
end if
if Ccol<>gridrowcolumnvalue("Viw_Prod.Packing") then
Rndx=1
end if
if gridrowcolumnvalue("Viw_Prod.Packing")="Pilot" then
totperx(Rndx)=totperx(Rndx)+currentfieldvalue
end if
formula=totext(currentfieldvalue,0,"") ' despite of cstr function totext will change 45 to 45 while cstr changes 45 to 45.00
CCust=gridrowcolumnvalue("Table_Cust.Name")
Ccol=gridrowcolumnvalue("Viw_Prod.Packing")
now we will edit "Display String" of grand total column
Global my as number
Global totperx(22) as number
whileprintingrecords
if my<1 then
my=1
end if
formula=currentfieldvalue-totperx(my)
my=my+1

Hide rows with no values in hierarchial grouping in crystal reports

I have a crystal report - showing some financial data. As normal with financial data we have several general ledger accounts - which are grouped hierarchically. We are using grouping in Crystal report with some totals on hierarchical groups.
There are some rows where the values are zero. The groups also have total of zero as a result of this. We need to hide these rows. If we try to check the sum of the field - on the group level - it hides all the parent rows (since they themselves do not have any value - only values are derived from the child rows).
Need some way to do this in crystal?
You can suppress rows base on a condition.
In the menu go to Report->Suppress Expert...
Select the details line then select the formula button next to Suppress
You only need to put the condition that will be true to suppress the line
{[Your value field]} = 0
For groups, you will need to find the sum of your total for that particular group
SUM({[Your value field]}, {[field you are using to grouped by]}) = 0

Crystal Reports Xi - Sorting a CrossTab Report by a Summary Field

So I have a simple crosstab report that calculates number of sales in the columns, and the rows are each office. The last column on the right is a total column, which contains a summary field (via a count of the identity field) that adds up the total number of sales per office.
How can I sort the crosstab data so the office with the most sales is the top row, and the rest in order under it?
Try this: Right-click on the crosstab. Go into the Group Sort Expert menu. There you will see options to display the top N rows, Sort All by the aggregate of a field of your choice, etc.
(I'm using Crystal XI. If your version is different, this may not work exactly)