Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Running Total Field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Running Total Field
 Login/Join
 
Platinum Member
posted
I have two rows of data for an ID:
ID:     Date:         Code:     Hours:  
123     01/01/2014    ABC       4
123     01/02/2014    ABC       5


I would like to add a fifth field that is the running total for the code "as of each row".

So the first row would have "Running Total" field value equal to 4, but the second row would have a "Running Total" field value equal to 9.

Is this possible?

This message has been edited. Last edited by: <Kathryn Henning>,


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
Maybe something like this:
TABLE FILE CAR
SUM
SALES
COMPUTE SALES_RT/D6 = SALES_RT + SALES;
RETAIL_COST
COMPUTE RETAIL_COST_RT/D6 = RETAIL_COST_RT + RETAIL_COST;
BY COUNTRY
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Yep. I also just found this after I posted.


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
Or this, if you need to reset the running total (and if the data is in the correct order for the report):
TABLE FILE CAR
SUM
SALES
COMPUTE SALES_RT/D6 = IF COUNTRY EQ LAST COUNTRY THEN SALES_RT + SALES ELSE SALES;
RETAIL_COST
COMPUTE RETAIL_COST_RT/D6 = IF COUNTRY EQ LAST COUNTRY THEN RETAIL_COST_RT + RETAIL_COST ELSE RETAIL_COST;
BY COUNTRY
BY CAR
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
What if I need to reset the total not just on country, but to only include records in the total that have a date that fall within a specific range in relation to the date of the record?

For example:
-the total for row 1 would have a total of all records that have a date value in the in the last 7 days from that date value (12/24/2013 to 01/01/2014).
-the total for row 2 would have a total of all records that have a date value in the in the last 7 days from that date value (12/25/2013 to 01/02/2014).


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
If you can translate "total of all records that have a date value in the in the last 7 days from that date value (12/24/2013 to 01/01/2014)" into an IF statement you should be able to put that in the COMPUTE.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
something like:

COMPUTE TOT7= IF ID EQ LAST ID AND COUNTRY EQ LAST COUNTRY AND DATE-7 GT LAST DATE THEN SALES + TOT7 ELSE SALES;


but this just gives me a running total still for the whole data set, it does not re-set when the result is false.


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
Maybe you should move your COMPUTE into a DEFINE instead...

Because you're now testing based on a date, COMPUTE will use the last or first (can't remember which one is stored in the Matrix when not specified) date from your WHERE selection.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Running Total Field

Copyright © 1996-2020 Information Builders