ireport - stacked measures in crossstab - jasper-reports

I want to create a crossstab with stacked measures but can't seem to figure out how to accomplish this. I basically want an output that looks like the below:
looks like this type of output can't be done using the crosstab wizard so I've tried manipulating the xml but still not getting this to work.....any suggestions would be greatly appreciated.
Thanks

You can achieve this, either by creating new variables for variance and adding them to row groups or by creating new fields, calculating the variance values in the java/sql code and using them as row group values in the crosstab.

Related

Prevent grouping column header in JasperReports

i want to make an Crosstab Template for my data.
For each value there is a timestamp, a location and the name of the device from which i get the value. So i am giving a list of values via Java and a JRBeanCollectionDataSource to my report, for the example below this would be 9 values while each of them has 3 additional parameters to place it on the right column/place in the crosstab.
When i give this sort of data to my Jasper Report with a Crosstab (Crosstab is needed cause i don't know how many rows and columns my report will have) in it, Jasper orders/groups the columns and the output looks like this:
But what i want is to show the data in the sequence i give them to my report, for example:
I am using Java to fill my report with a JRBeanCollectionDataSource and a self defined DataSource (this works perfect, i am working with this method for months).
Is there any way this kind of column grouping could be prevented? (i have a working crosstab template but i am not able to find the propertie with the help of i can solve my problem)
Hope you people can help me.
Have you tried to tell the crosstab that your data ir already sorted?
http://jasperreports.sourceforge.net/schema.reference.html#crosstabDataset
Click the crosstab element, in the Dataset Tab, mark "Data Pre Sorted".

Tableau - showing sums and percentages in columns

I am interested in creating a table that contains both sums and percentages for a collection of measures. The values should be presented side-by-side. So, I can can easily generate counts for all measures.
I can then duplicate the sheet and easily generate row percentages.
How do I get these values side-by-side on the same chart -- something like:
G1 G2 G3 G4
Gender-Male 4,557 40.38% 4,387 37.78% 1,349 11.73% 1,301 10.11%
Gender-Female 4,694 37.71% 4,586 39.92% 1,497 12.13% 1,053 10.24%
...
Try this!
Firstly you'll need couple of calculated fields :
1: Percentage of Total =sum(value)/total(sum(value))*100
2: For getting the CSV like your output
str(sum([Value]))+' , '+left(str([% Of Total]),6)+'%'
To get the output something like this:
However I wouldn't suggest this : like Measure,% of Measure .
Instead Ideally you should just use the tableau calculation
Which looks like below:
Yes Table calculation would do that .
Please check the solution at :
https://public.tableau.com/profile/publish/34558348/Sheet5#!/publish-confirm
Also, you need to uncheck show header for Measure Names

How to calculate cumulative field values in report

I am new to JasperReports and iReport, and I am facing a problem. Before going through the question, first, please take a look at the following image:
So, the main problem is with the cumulative columns. Per say, the "Cumulative Bill" column should show the following values sequentially:
6000.0, 14000.0, 23000.0, 32800.0, 42800.0 and 45800.0
I have no idea how this can be done. I tried creating a new variable, but there is no cumulative type calculations there. Please assist me.
Create variable $V{variableName} with calculation = Sum and Variable expression = $F{BillAmountField} and put text field with this variable into detail section.
Is it so hard? :)
It can be done at the query level, here is the query :-
SELECT m.bill_amount,
#cbill:=#cbill+ifNull( m.bill_amount,0) cumulative_bill
FROM (
SELECT #cbill:=0,
bill_amount
FROM
)m

Sparkline based on Expression using custom code

I have an SSRS report which is reporting sales grouped by Month. One of the columns in this report is a calculated fields which takes 2 values and passes them to a custom code routine that is defined for this report. The textbox that is populated with the following code:
=Code.DivideBy(ReportItems!textbox21.Value, ReportItems!EarnedIncome1.Value)
All this Custom Code does is to divide the First Parameter by the Second Parameter (in this case whatever is in textbox21/EarnedIncome). The response is them shown on the screen as a percentage.
Below is an example of the report:
1 http://www.propelpos.com/images/screenshot002.jpg
This worked great. What we are trying to do now is to graphy the % that is in the BDX Loss ratio column which is figured out by the formula above (dividing Losses by Earned Premium)
When I try to copy the expression in the chart data and set the Category Groups to PeriodYearMonth (same as all the others), then I get a straight line.
I have no idea where to go next. Any ideas would be much appreciated.
I agree with #Neil. You can also Add the Calculated field in you data set properties. Take a look at the following screen. You can set the expression to calculate the data for your line chart.
Hope this helps!
I would suggest doing the calculation in your query and then using that computed column in SSRS. If you need help figuring out how to do that, let me know.

How to get the design in iReports

I want the below design in iReports where column is generated dynamically based on a formula.
How can this be done? Please suggest.
You can use list component to achieve this.
I suggest that you use the crosstab component.
The crosstab allows you to set a data source for printing the columns.
The problem is, I don't know (and maybe it is not possible) to dynamically adjust the column with. If the number of columns varies in size your report will not have always the same layout.