Mithlesh Singh February 2016
How can I show sum of columns in column header?
I have to design jasper report in iReport 5 tool
I need to show sum of each column in header like in image
How can I show columns vertical like in image
Is it possible to design report like this.
Bilal DEKAR February 2016
in this type of reports, you can use a crosstab, you put a field than name it monthly. Use in the columns and a field name it month in rows, and use the sum function in cells
<rowGroup name="month" width="128" totalPosition="End">
<columnGroup name="monthlyUse" height="66">
<measure name="nameMeasure" class="java.lang.Integer" calculation="Sum">
the crosstab will generate a table shwoing the monthly usage with a total row
Fabio Fantoni February 2016
if you're not familiar with crosstab, as previously suggested, you could create a subreport just to show the column totals and put it "before" the detail band (for example in the page header band).
obviously, following this way, you will access the datasource twice, and this could could be something you want to avoid, especially if time matters.
basically, a crosstab is the better solution overall, but if you need something simpler (maybe you're not familiar with iReport) or one-shot-like you could think about a subreport
Petter Friberg February 2016
Using the normal
detail band and
columnHeader band this is achieved by creating a variable with
calculationType="sum" on the field you like to sum
How to sum all values in a column in Jaspersoft iReport Designer?
Then display the variable using a
textField in the
columnHeader band, setting
evaluationTime="Report" so that variable is calculated before displaying it.
To rotate a
textElement vertical use the
rotation attribute (
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReportTest" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" uuid="43c90ca5-f3c3-4dda-8423-9ff1442f90e3">
<![CDATA[select * from mytable]]>
<field name="descr" class="java.lang.String">
<field name="value" class="java.lang.Double">
<variable name="sumValue" class="java.lang.Double" calculation="Sum">
Asked in February 2016
Viewed 2,481 times
Answered 3 times
Leave an answer
Quote of the day: live life