How to calculate cumulative field values in report - jasper-reports

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

Related

column wise addition in tableau worksheet

I have made this tableau Worksheet. All columns are derived using calculated field. Based on resource I am calculating all attributes.
Please help me to add all values column wise in same worksheet .
I tried using "total" available in analytics pane but its not working in this case .
Thanks and Regards
The way this is set up, which each column being a calculated field, to sum them also requires a calculated field.
[ColumnA]+[ColumnB]+[ColumnC]+etc
Adding Totals to the table won't work in this case, as you have discovered.

Is it possible to sum the expression column in SSRS

I am stuck in a scenario where client needed to do sum of column which is containing calculated values(Expressions) which are calculated at the run-time (At the time of generating report).
I suggested client to calculate this column at database side and return this column to SSRS dataset but due to some circumstances it is not possible.
Any help on this will be greatly appreciated.
Thank You
I don't have comment access So Iam not able to ask you more details. You can SUM up the calculated expression in SSRS AS you didn't mention how it looks.I am getting one example.
If this is how your normal cell of calculation looks,
=Fields!FirstCol.Value+Fields!SecondCol.Value
Then the SUM can be
=SUM(Fields!FirstCol.Value)+SUM(Fields!SecondCol.Value)
And if you added the calulatedColumn in the Dataset itself then it becomes more simple as you just have to do as,
=SUM(Fields!CalculatedCol.Value)

Crystal Report: Get Minimum Date

I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/

Crystal Report - How to sum by item number during a time period

I am wondering if we can sum by item number which looks like sum(quantity, item#) but I don't know if I want it to sum the quantity specific from date A to date B how can i do that. Please let me know if you figured out.
Create a formula field:
//{#quantity}
If {view.date_field} In Date(2013,06,01) To Date(2013,06,30) Then
{view.item_quantity}
Insert a group on the {view.item_number} field (Insert | Group...)
Insert a summarized field on the formula field (Insert | Summary...), specify the group that you just created.
the answer lies within your question, the formula that you have written is called conditional sum.
sum(quantity, item#);
create a formula writing exactly the same thing, but replacing the arguments with the actual database fields which I assume would make the formula, somewhat like this.
sum({view.item_quantity}, {view.item_number});
hope this helps...

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.