crystal crosstab need to limit columns # of columns - crystal-reports

I am using a Crystal crosstab. My rows are lab results and my columns are dates. I am sorting the dates in descending order so that the most current dates are listed first. I know I can use the TopN formula for rows to limit to a certain number of rows but I need to limit it to a certain number of columns preferably 10. In the example below I would not want to show anything after 10/10/11.
10/1/12 9/3/12 7/16/12 5/8/12 4/22/12 3/17/12 1/9/12 12/3/11 11/15/11 10/10/11 9/23/11 8/18/11 7/7/11 6/8/11
Calcium 8.5 9 9.1 9 8.9 8.9 9 9 9 9 9 9 8.9 9
Vitamin D 45 45 51 49 56 50 51 55 60 66 60 59 60 61
Any guidance would be greatly appreciated.
Thanks
Jill

I think the cross tab can only limit columns if the names are specified which will not be possible with dates.
There are two possible work arounds I can think of:
1 - limit via the query:
Go to Report > Select Expert > Record and select the date field, click formula then add this formula (for 10/10/2011):
{Mytable.DateField} < Date (2011, 10, 10)
or for a dynamic date (older than 1 year):
{Mytable.DateField} < DateAdd ("yyyy", -1, CurrentDate)
2 - The other option is to create cross-tab as a standard report, this means the dates will be vertical rather than horizontal.
You can add a group to the report by date then add values for each type as summaries, let me know if you prefer this and I can explain in more detail.

Related

Tableau display 3 measures in 1 column

I am building a report in Tableau with 4 fields. 3 of these fields are measure fields. This is what it looks like.
Name Sum Profit Loss
Emmy 15 10 5
Sara 23 18 2
Dave 10 1 2
But, I want it to look like this. I want a new column called metrics that pulls in those 3 values.
Metrics
Emily 15
10
5
Sara 23
18
2
Dave 10
1
2
May I have some guidance on how I can approach this?
The easiest way to solve this is by bringing "Measure Names" to Rows
You can hide the header names of the measures as well. hope that helps

select every 3rd participate from a list and make and average in matlab

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)

How to Sum values of column corresponding to one column in jasper

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

Calculating MAX(DATE) for Value Groups Where Values Go Back and Forth

I have another challenge that I am trying to resolve but unable to get the solution yet. Here is the scenario. Pardon the formatting if it messes up at the time of posting.
ACCT_NUM CERT_ID Code Date Desired Output
A 1 10 1/1/2007 1/1/2008
A 1 10 1/1/2008 1/1/2008
A 1 20 1/1/2009 1/1/2010
A 1 20 1/1/2010 1/1/2010
A 1 10 1/1/2011 1/1/2012
A 1 10 1/1/2012 1/1/2012
A 2 20 1/1/2007 1/1/2008
A 2 20 1/1/2008 1/1/2008
A 2 10 1/1/2009 1/1/2010
A 2 10 1/1/2010 1/1/2010
A 2 30 1/1/2011 1/1/2011
A 2 10 1/1/2012 1/1/2013
A 2 10 1/1/2013 1/1/2013
As you can see, I need to do a MAX on the date based on each group of code values (apart from ACCT_NUM and CERT_ID) before the value changes. If the same value repeats, I need to a MAX of the data again for that group separately. For example, for CERT_ID of '1', I cannot group all four rows of Code 10 to get a MAX date of 1/1/2012. I need to get the MAX for the first two rows and then another MAX for the next two rows separately since there is another code in between. I am trying to accomplish this in Cognos Framework Manager.
Gurus, please advise.
The syntax for getting the max value for CERT_ID is:
maximum(Date for CERT_ID)
If you want additional level/s for max you can use the following syntax:
maximum(Date for ACCT_NUM,CERT_ID,Code)
In general, it is best practice to group and summarize values in report, not in framework manager.

Sort and calculation in Crystal Reports

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