Sum previous with current column


Hi, I have a table in my ad hoc view that look like this

Oct Nov Dec Jan
3 5 0 4

Is it possible to sum previous with current column like this?

Oct Nov Dec Jan
3 8 8 12


alexander.backlund's picture
Joined: Sep 21 2015 - 11:42pm
Last seen: 5 years 2 months ago


there are two options of doing this.

1.) you can write your query like this

select oct as oct ,(oct+nov) as nov,(oct+nov+decm) as decm from Table_name;

2.) If you want to do in jasper you have to edit the exp of text fields. i am giving the XML code of detail section of my report.

you can refer to that.(Same exp that you are putting in the query you can put in text fields)



        <band height="125" splitType="Stretch">
            <textField isStretchWithOverflow="true">
                <reportElement x="0" y="0" width="100" height="20"/>
            <textField isStretchWithOverflow="true">
                <reportElement x="100" y="0" width="100" height="20"/>
            <textField isStretchWithOverflow="true">
                <reportElement x="200" y="0" width="100" height="20"/>

ankit830 - 6 years 3 months ago

0 Answers:

No answers yet