I'm just beginning with Report Builder and I am trying to get an average of the value of one field if another field equals a number.
Example:
A table that contains a series of book reviews by different reviewers identified by number:
Reviewer Score
1 95
2 85
3 77
3 99
1 87
What I want is to get a reviewer's overall average score. So i would like to get an average of all scores filtering out the other reviewers.
I have been at this for a couple hours now and I don't think I am even close...
=Avg(iif(reviewer="1",score,Nothing))
I have used this successfully in my report.
Related
I got 3 lists with grades ranging from 0-100 represting 3 different tests.
each list has an equal number of indxes (represting participates).
For example- the 1st indexes in the lists- list1,list2 and list3, are the grades of the first particiapte in the 3 different tests.
I need to make a new group (named group1) that select evey 3rd participate, starting from the first, and than calculate the avarage of this group scores.
i'll appriciate any help!!
Hopefully instead of three 'lists' you are actually using a 3 column matrix for this? e.g.
testScores = [20 48 13;
85 90 93;
54 50 56;
76 80 45
...]
From here it is trivial to select every third participant:
testScores(1:3:end, :)
and then to find the mean:
mean(testScores(1:3:end,:),2)
In jasper i have one requirement like, sum all the data of the column based on another column. I know how to show sum of all the data in the column. But please suggest me for this requirement.
Emp-Category Emp-Id Salary
---------------------------------------
Cate - A 1 128
2 50
3 89
total 267
Cate - B 4 123
5 50
6 100
total 273
Total Expenses 540
So there will be many number of categories, which will be getting from database.
Please suggest me how to do this approach.
In that case, you can use groups...
You can refer to the link below for tutorial :)
http://www.tutorialspoint.com/jasper_reports/jasper_report_groups.htm
For each record, there is a particular calculated field. The value of that field is obtained by the difference of the value in the next record. So sorting should be correct for the right value of this field. But now the report shown to the user is grouped in many sections and sorted in different ways, but I want the field to be of right value (based on one sort).
In short, how can I sort the records based on,say 'A', and do the calculation and display it based on different combinations of sort?
Links, pointers appreciated.
Example:
Original sort by Age for calculation
Name Age Diff
-------------
Mark 60 5
Pete 65 7
Nath 72 0
Values of Diff should still hold in different sort
Name Age Diff
-------------
Mark 60 5
Nath 72 0
Pete 65 7
I want to count the total no of records found under a group and according to that i need to assign reduction percentages.
In Detail,
if a user got less than 3 products he ll get 10%
if a user got 4-10 products he ll get 15%
if he got 10-20 products he ll get 20% as deduction
For example consider the following as a crystal report:
User 1
Product Deduction
Apple 15 %
Orange 15 %
Lemon 15 %
Strawberry 15 %
Grapes 15 %
Here i made a count of records in this group using running total and worte a formula. Depends on the count its ll make the deductions
But the problem in getting is, I'm getting the following output...
User 1
Product Deduction
Apple 10 % // Since count is 1
Orange 10 % // Since count is 2
Lemon 10 % // Since count is 3
Strawberry 15 % // Since count is 4
Grapes 15 % // Since count is 5
I wanna make all products deduction as 15 % if the total no of records are 4-15. Here the total no of products is 5 its in the range of 4-15 so all the product should have the deduction as 15 %.
Please help me out to solve this?
You don't need a running-total field (RT) for a simple count; use a summary field instead. The summary field can be used in the group's header and footer (a RT can only be used in the footer).
Select a field (preferably a unique field), then select Insert | Summary Field... Choose Count or Distinct Count from the picklist.
You can use this summary in a formula as well:
//{#discount}
//Assumes there is a group on {table.fruit_name}):
SELECT Count({table.key_field}, {table.fruit_name})
CASE 1 to 3: .1
CASE 4 to 5: .15
DEFAULT: 0
I am using Crystal 9 and have created a report showing calls logged by users, time taken to close the call, Solved with (allocated a value to the latter field depending on time taken eg. 1-59 mins = < 1 hr = 1), 60-239 mins = < 4 = 4. I have then grouped the results by users and got totals for each of the Solved values
Solved1 = solved in less than 1 hour
eg group total shows (when record data hidden)
User1 (Total Calls= 74) (Solved1 = 42) (Percentage1 = 56.76)
User2 (Total Calls= 17) (Solved1 = 2) (Percentage1 = 11.76)
Total Calls and Solved1 are obtained using Running Total Fields.
Percentages are Formula fields and calculated as follows:
Percentage1 = Solved1/Total Calls * 100
My problem is that I need to graph the percentage values for each user for each Solved value eg. 56.76 and 11.76 on one chart. This would be easy except that Crystal doesn't let me select this field in the chart option because it's calculated from two Running Totals.
Since some formulas are accepted by the Chart expert and running totals are also accepted, is there a way I can calculate the percentage which it would find acceptable? Or can I put the total and Solved value in the chart and have the chart calculate the percentage somehow? I was looking at using count and I can get the count to count all the records for a single person but not where say the value in a specific field = '1'
eg count (call_id, )/count (call_id, closedby) * 100
Does anyone know how I can write that fomula or any other way of graphing a percentage?
You can do this using Crystal formulas.
Set up a formula for Solved1 - something like
if {myTable.timeTaken} < 60 then 1 else 0
Next, set up a formula for Percentage1 - something like:
100*sum(#Solved1,{myTable.closedBy}) / count({myTable.call_id},{myTable.closedBy})
Drag and drop the formula for Percentage1 onto the report layout, then you should be able to add it from Report Fields onto your graph in the Data tab of the Chart Expert. (You may then want to remove the Percentage1 formula item from the report layout.)
I ran into a similar issue trying to graph On Time Delivery percentages.
I have three percentages to display: On Time, 1-3 days late, and over 3 days late.
I was in need of displaying zero percents as well, i.e. when there were no records that were "1-3 days late" I still needed to show 0% as one of my bars. The above did not address that. I ended using this resolution with a twist.
I created 4 formulas:
one to return 1 if the record was on time else 0
one for the 1-3 days,
one for the over 3 records.
one for each record returning a value of 1.
With that I was able to create my percentage fields using the Sum of one of the first 3 formulas divided by the sum of the "1" formula. Crystal would not work if I used the Count(...) function on a key field. It only worked when using the Sum(...) function in my percentage formulas.