Focal Point
[CLOSED] Creating a column to cumulate value of other column in same report

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3197043486

October 25, 2016, 10:55 AM
Glenn Werner
[CLOSED] Creating a column to cumulate value of other column in same report
I have a query/report I am building.

I need to create a column that will be a cumulative count.

So, in this instance, it changes if one column is value 1 and if a second column equals a third then the second column value is put into the cumulative column.

Like, SEQ = 1, DLA = 12 and OTP = 12 therefore *** = 12

But if there are actually 4 delays associated with a unique train+date combination then I need to be able to cumulate the number like:

SEQ DLA OTP ***
1 4 25 4
2 6 25 10
3 2 25 12
4 13 25 25

Is it possible to create this column value within the InfoAssist report?

This message has been edited. Last edited by: Tamra,


WebFOCUS 8
Windows, All Outputs
October 26, 2016, 02:41 AM
Dave
quote:
it changes if one column is value 1 and if a second column equals a third then the second column value is put into the cumulative column.


What?!?!


This will get you going I guess:
TABLE FILE CAR
	SUM SALES/D12C
		COMPUTE CUME_COUNTRY/D12C = IF LAST COUNTRY EQ COUNTRY THEN CUME_COUNTRY + SALES ELSE SALES;
	BY	COUNTRY
	BY	CAR
	BY	SEATS
END



_____________________
WF: 8.0.0.9 > going 8.2.0.5
October 26, 2016, 02:42 AM
Dave
Oh, and welcome to the forum. Big Grin


_____________________
WF: 8.0.0.9 > going 8.2.0.5
October 26, 2016, 03:52 PM
Tamra
Glenn,

Yes, Welcome to the forum!

The answer from one of our very helpful members is code related - you can accomplish the same idea using the GUI tool.

Within the InfoAssist tool - take the example provided with the COMPUTE logic and add your fields as needed.
To add a calculated new field:
- click on "Data" tab in the top tool bar
- the field appears as Compute_1 - change to the example's CUME_COUNTRY
- change the Format if necessary
- in the blank space added the logic after the "=" in the example provided - the ";" is not needed

Based on the sorted fields the LAST command compares the current record to the previous record and then evaluates the IF / THEN / ELSE.

With the information provided by Dave and the InfoAssist steps above this should 'get you started'

Let us know how you are getting along with your report. We are all here to help out.

Thank you for participating in the Focal Point Forum.

Kind Regards,
Tamra Colangelo
IBI Focal Point Moderator


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5