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     SOLVED-ROLLING CALCULATION DISPLAY QUESTION

Read-Only Read-Only Topic
Go
Search
Notify
Tools
SOLVED-ROLLING CALCULATION DISPLAY QUESTION
 Login/Join
 
Platinum Member
posted
I've conducted quite a search on the forum, and I found code on how to create the rolling calculation (and I SO appreciate that). Perhaps I overlooked the obvious answer for the last part of my report. I'd appreciate any guidance.

Q. How do I display only the last year of a rolling calculation at the far right of a tabular report?

Details:

1. I have customer counts for years 2008-2015. I want to display all years' customer counts, along with the year.
2. I need a rolling calculation to determine the five-year difference for the last five years of data only, in this case, the percentage of change from 2010 to 2015 only. See PERCENT_LAG_5
3. I need a rolling calculation to determine the one-year difference for the last year of data only, in this case, the percentage of change from 2014 to 2015 only. See PERCENT_LAG_1
4. After I add customer count data for 2016, I want the calculation to automatically adjust to calculate 2011 to 2016 for the five-year difference and 2015 to 2016 for the one-year difference.

Here's my code thus far:

TABLE FILE MV_CUSTOMERS
SUM
MV_CUSTOMERS.MV_CUSTOMERS.HEADCOUNT/D10
COMPUTE LAG_1/D10 = IF STORE EQ LAST STORE THEN LAST HEADCOUNT ELSE 0;
COMPUTE LAG_2/D10 = IF STORE EQ LAST STORE THEN LAST LAG_1 ELSE 0;
COMPUTE LAG_3/D10 = IF STORE EQ LAST STORE THEN LAST LAG_2 ELSE 0;
COMPUTE LAG_4/D10 = IF STORE EQ LAST STORE THEN LAST LAG_3 ELSE 0;
COMPUTE LAG_5/D10 = IF STORE EQ LAST STORE THEN LAST LAG_4 ELSE 0;
COMPUTE PERCENT_LAG_1/D10.1% = IF LAG_5 NE 0 THEN ( HEADCOUNT - LAG_1 ) / LAG_1 * 100 ELSE 0; AS '%,One Year Diff'
COMPUTE PERCENT_LAG_5/D10.1% = IF LAG_5 NE 0 THEN ( HEADCOUNT - LAG_5 ) / LAG_5 * 100 ELSE 0; AS '%,Five Year Diff'
BY LOWEST MV_CUSTOMERS.MV_CUSTOMERS.REGION
BY MV_CUSTOMERS.MV_CUSTOMERS.STATE
BY LOWEST MV_CUSTOMERS.MV_CUSTOMERS.STORE
BY LOWEST MV_CUSTOMERS.MV_CUSTOMERS.YEAR
WHERE ( MV_CUSTOMERS.MV_CUSTOMERS.SALES_TERM EQ 'CY' );

I placed the above in a HOLD file.

The second part of my code goes like this:

TABLE FILE EXPORTHC
SUM
EXPORTHC.EXPORTHC.HEADCOUNT
EXPORTHC.EXPORTHC.PERCENT_LAG_1
EXPORTHC.EXPORTHC.PERCENT_LAG_5
BY EXPORTHC.EXPORTHC.REGION
BY EXPORTHC.EXPORTHC.STATE
BY EXPORTHC.EXPORTHC.STORE
ACROSS LOWEST EXPORTHC.EXPORTHC.YEAR

That's as far as I've gotten. I get the calculations I want, but I get them for other years I don't want such as the five-year difference between 2008-2013. I only want the last five-year difference and the last one-year difference to appear in my report at the far right.

I'm using Dev Studio and am on WebFocus version 8.0.09, and I've only been using WebFocus since September 2015.

Thank you in advance.

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


WebFocus 8.2.04
WebFocus 8.2.04

 
Posts: 191 | Registered: September 18, 2015Report This Post
Expert
posted Hide Post
If I understand you correctly, then this should do what you need -

TABLE FILE EXPORTHC
  SUM MAX.PERCENT_LAG_1 AS 'Lag 1' NOPRINT
      MAX.PERCENT_LAG_5 AS 'Lag 5' NOPRINT
   BY REGION  AS 'Region'
   BY STATE   AS 'State'
   BY STORE   AS 'Store'
  SUM HEADCOUNT AS 'Head Count'
   BY REGION  AS 'Region'
   BY STATE   AS 'State'
   BY STORE   AS 'Store'
ACROSS YEAR AS 'Year'
COMPUTE LAG_1/D10.1% = MAX.PERCENT_LAG_1; AS 'Lag 1'
COMPUTE LAG_5/D10.1% = MAX.PERCENT_LAG_5; AS 'Lag 5'
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  grid=off, size=10, $
ENDSTYLE
END
-RUN


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Tony,

It's so very close!

The format is perfect; however, the lag percentages are taking the maximum value of my lag percentages from my hold file instead of the last year.

For example, for the first line of my data, the hold file came up with three lag_1 values of 1.2, 2.7 and .1, respectively for 2013, 2014, and 2015. I want the last value of .1. The code you provided takes the maximum value of 2.7.

Any thoughts?

And thank you for your previous help!


WebFocus 8.2.04
WebFocus 8.2.04

 
Posts: 191 | Registered: September 18, 2015Report This Post
Platinum Member
posted Hide Post
Thank you, Tony.

I changed the MAX references to LST, and I think I got it.


WebFocus 8.2.04
WebFocus 8.2.04

 
Posts: 191 | Registered: September 18, 2015Report This Post
Expert
posted Hide Post
Well done to you Smiler Bearing in mind that I didn't have your data, I obviously took the wrong prefix operator!

It's refreshing that someone actually takes the suggestion and then tries to work it out for themselves a little more. I wish some others would do what you have done Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report 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     SOLVED-ROLLING CALCULATION DISPLAY QUESTION

Copyright © 1996-2020 Information Builders