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] LAST function (sql intersect/recursive join)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] LAST function (sql intersect/recursive join)
 Login/Join
 
Gold member
posted
Potentially stupid question;

lets say I have:
Jan Feb Mar Aprl
units: 100 100 0 0

where I have 100 units for present and past months, and want to predict Units in the future with some basic math on a delta.
Expected Result:
Jan Feb Mar Aprl
units: 100 100 0 0
future: 100 100 105 110



If I use LAST units:
COMPUTE future/I3 = IF date LE today THEN units ELSE LAST units+delta;
Jan Feb Mar Aprl
units: 100 100 0 0
future: 100 100 105 5


If I LAST future:
COMPUTE future/I3 = IF date LE today THEN units ELSE LAST future+delta;
Jan Feb Mar Aprl
units: 100 100 0 0
future: 100 100 0 0


Am I missing a intersect command or something that I can use?

This message has been edited. Last edited by: Kathleen Butler,


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Report This Post
Virtuoso
posted Hide Post
There's a FORECAST function in WF that does this type of stuff. Moving Average, single, double and triple exponential smoothing and Linear Regression. You can find the syntax for it in the documentation.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Gold member
posted Hide Post
Oh, nice! I will have to look into that!

but for this case I have scheduled gains and loses that I want to apply (delta).

So I really need to carry Units@present into the future months


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Report This Post
Master
posted Hide Post
Nicholas,

Can you post your actual code, or use the car file to create a sample. From what you wrote as your compute, it looks like the third option is correct. The problem might be in the way that you are ordering your data.

Thanks!


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Gold member
posted Hide Post
So I have it working with 3 computes to show 3 months out:

      COMPUTE future1/I6 = IF Date_Calendar_Month_YYYYMM LE &CURYM THEN Leased ELSE LAST Leased + Lease_Begin - Lease_End; OVER 
     COMPUTE future2/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE1 THEN future1 ELSE LAST future1 + Lease_Begin - Lease_End; OVER 
     COMPUTE future3/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE2 THEN future2 ELSE LAST future2 + Lease_Begin - Lease_End; OVER  


I thought that it didn't like the recursive reference, but I have CAR working using the recursive;

 TABLE FILE IBISAMP/CAR
SUM 
     MPG
     COMPUTE CUMMULATIVE_MPG/D6 = MPG + LAST CUMMULATIVE_MPG;
BY  CAR
END
 


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Report This Post
Master
posted Hide Post
What are your BY fields? It could have to do with the way you have organized those.

As you've noticed the problem isn't in the recursiveness of the statement since you have it working as expected with the car file.

At this point I think the best way for us to give you answers is for you to post your code. We can probably find your issue pretty fast if you do that.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Master
posted Hide Post
The problem could also be in your fields TODAY and DATE. What format are they? Are they actually YYM? or are they Alphas for April May June etc? Its possible that the comparison is failing, giving you unites instead of FUTURE + DELTA....


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Expert
posted Hide Post
Are you using ACROSS and expecting LAST to relate to the previous column (and therefore not row)?

If so, then that is your issue.

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
Gold member
posted Hide Post
TABLE FILE LAHOLD1
SUM
     Notice_For_Move_Out AS 'Notice For Move Out' OVER
     Skipped_Lease AS 'Skipped Lease' OVER
     Eviction_Count AS 'Eviction Count' OVER
     Lease_End AS 'Leases Expire' OVER
     LEASE_BEGIN_NEW_LEASE AS 'Leases Begin - New Leases' OVER
     LEASE_BEGIN_RENEWAL AS 'Leases Begin - Renewal' OVER
     Lease_Begin AS 'Leases Begin - Total' OVER
     COMPUTE RENEWAL_RATIO_PCT/D12.2% = 100 * Renewal_Ratio__; AS 'Renewal Ratio %' OVER
     Leased/I6 OVER
     COMPUTE future1/I6 = IF Date_Calendar_Month_YYYYMM LE &CURYM THEN Leased ELSE LAST Leased + Lease_Begin - Lease_End; OVER
     COMPUTE future2/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE1 THEN future1 ELSE LAST future1 + Lease_Begin - Lease_End; OVER
     COMPUTE future3/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE2 THEN future2 ELSE LAST future2 + Lease_Begin - Lease_End; OVER
     Vacant OVER
     Units/I7 OVER
     Left_To_Lease AS 'Left To Lease'
ACROSS LOWEST Date_Calendar_Month_YYYYMM NOPRINT  AS 'YYYYMM'
ACROSS LOWEST Date_Calendar_Month_YYYYMM AS 'Month'


Dates, and &var are I6. IE) &CURYM = 201602.

Tony may have it. I am displaying across Month and I want to go to the last month's value.

I know having 3 computes isn't optimal, but is there strong argument against using the 3 computes and showing the 3rd one?


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Report This Post
Master
posted Hide Post
Nicholas,

Use a hold file. The order of the data is extremely important when using last. Make your dates BY fields and remove the overs. Hold the data and then put your across back in. like this:

 
TABLE FILE LAHOLD1
SUM
     Notice_For_Move_Out
     Skipped_Lease 
     Eviction_Count 
     Lease_End 
     LEASE_BEGIN_NEW_LEASE 
     LEASE_BEGIN_RENEWAL 
     Lease_Begin
     COMPUTE RENEWAL_RATIO_PCT/D12.2% = 100 * Renewal_Ratio__;
     Leased/I6 
     COMPUTE future1/I6 = IF Date_Calendar_Month_YYYYMM LE &CURYM THEN Leased ELSE LAST Leased + Lease_Begin - Lease_End; 
     COMPUTE future2/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE1 THEN future1 ELSE LAST future1 + Lease_Begin - Lease_End; 
     COMPUTE future3/I6 = IF Date_Calendar_Month_YYYYMM LE &FUTURE2 THEN future2 ELSE LAST future2 + Lease_Begin - Lease_End; 
     Vacant 
     Units/I7 
     Left_To_Lease 
BY LOWEST Date_Calendar_Month_YYYYMM 
ON TABLE HOLD AS LAHOLD2
END
TABLE FILE LAHOLD2
SUM
     Notice_For_Move_Out AS 'Notice For Move Out' OVER
     Skipped_Lease AS 'Skipped Lease' OVER
     Eviction_Count AS 'Eviction Count' OVER
     Lease_End AS 'Leases Expire' OVER
     LEASE_BEGIN_NEW_LEASE AS 'Leases Begin - New Leases' OVER
     LEASE_BEGIN_RENEWAL AS 'Leases Begin - Renewal' OVER
     Lease_Begin AS 'Leases Begin - Total' OVER
     RENEWAL_RATIO_PCT OVER
     Leased/I6 OVER
     future1 OVER
     future2 OVER
     future3 OVER
     Vacant OVER
     Units/I7 OVER
     Left_To_Lease AS 'Left To Lease'
ACROSS LOWEST Date_Calendar_Month_YYYYMM NOPRINT  AS 'YYYYMM'
ACROSS LOWEST Date_Calendar_Month_YYYYMM AS 'Month'
END
 


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Gold member
posted Hide Post
Eric is right. best method is to order carefully, and use LAST only with BY fields. If needed, HOLD and use ACROSS

Thanks all!


_____
WF 8.1.04
Win 7// Windows Server 2012 R2
SASS OLAP Cube
 
Posts: 92 | Registered: July 31, 2015Report 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] LAST function (sql intersect/recursive join)

Copyright © 1996-2020 Information Builders