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] Consecutive Days Under Budget GGSALES

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Consecutive Days Under Budget GGSALES
 Login/Join
 
Gold member
posted
I'm having problems wrapping my head around doing a calculation. I'm trying to figure if the latest day of sales is under budget, how many consecutive days were sales under budget.

Using the following from GGSALES:
  
TABLE FILE GGSALES
SUM
UNITS
BUDUNITS
COMPUTE UNDERBUD/I1=BUDUNITS GE UNITS;
BY PRODUCT
BY HIGHEST DATE
END


I would expect the results to be:
Biscotti 1
Capuccino 1
Coffee Grinder 1
Croissant 1
Espresso 1
Latte 1
Mug 2
Scone 1
Thermos 2

Thank for the help!

This message has been edited. Last edited by: FP Mod Chuck,


WF 8.0.08 (Prod); WF 8.2.06 (Dev)
 
Posts: 83 | Location: OK | Registered: November 19, 2015Report This Post
Silver Member
posted Hide Post
I am not sure you are asking for what you really need. The above file the dates are unique and therefore BY HIGHEST DATE will the same as BY DATE. from the example data you have given you are calculating based on the last two months of sales.

You can achieve these results with this code but I am not convinced this is really what you want. Could you give a better description of what you are trying to achieve?

 

TABLE FILE GGSALES
SUM
UNITS
BUDUNITS
COMPUTE UNDERBUD/I1=BUDUNITS GE UNITS;
BY PRODUCT
BY  HIGHEST 2 DATE 
ON TABLE HOLD AS H1
END

TABLE FILE H1
SUM UNDERBUD
BY PRODUCT
END

 


WebFOCUS 8.2.02M
Windows
Server/8.2.02M
All Outputs
 
Posts: 43 | Location: Odessa, Florida | Registered: July 26, 2011Report This Post
Gold member
posted Hide Post
BY HIGHEST DATE gives me the most recent date to the least most recent date. By DATE sorts the other way around. I'm looking for what's happening since the most recent date.

I want to see:
1. How many consecutive days of sales has UNDERBUD been 1, when
2.The most recent day has an UNDERBUD of 1.

This message has been edited. Last edited by: evan.brown,


WF 8.0.08 (Prod); WF 8.2.06 (Dev)
 
Posts: 83 | Location: OK | Registered: November 19, 2015Report This Post
Virtuoso
posted Hide Post
quote:

MReeder said :
therefore BY HIGHEST DATE will the same as BY DATE

When not specified (by default) a BY is always accomplish with LOWEST as the order.
Which mean that the order is done by the lowest to the greatest value. So a BY HIGHEST is ordering by the greatest to the lowest value; it doesn't make the same result.

Something such as this may suits your need.
I have convert the date to YY-MM just for the sample.
DEFINE FILE GGSALES
YRMTH /YYM = DATE
END
TABLE FILE GGSALES
SUM UNITS
    BUDUNITS
    COMPUTE UNDERBUD/I1=BUDUNITS GE UNITS;
BY PRODUCT
BY YRMTH
ON TABLE HOLD AS EXTDATA
END
-RUN

DEFINE FILE EXTDATA
CONSEC /P3 = IF LAST PRODUCT EQ PRODUCT THEN 
                (IF LAST UNDERBUD EQ 1 AND UNDERBUD EQ 1 THEN CONSEC + 1 ELSE (IF UNDERBUD EQ 1 THEN 1 ELSE 0))
			 ELSE (IF UNDERBUD EQ 1 THEN 1 ELSE 0);
END
TABLE FILE EXTDATA
SUM UNITS
    BUDUNITS
    UNDERBUD
    CONSEC
BY PRODUCT
BY YRMTH
ON TABLE HOLD AS RPTDATA
END
-RUN

DEFINE FILE RPTDATA
ISUNDERBDG /A3 = IF CONSEC GT 0 THEN 'Yes' ELSE 'No';
END
TABLE FILE RPTDATA
PRINT ISUNDERBDG AS 'Current Mth,Under,Budget'
      CONSEC     AS 'Nb Consecutive Mth,Under Budget'
BY PRODUCT
BY HIGHEST 1 YRMTH NOPRINT
ON TABLE SET PAGE-NUM NOLEAD
END


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
Gold member
posted Hide Post
Perfect, that CONSEC calculation was what I had trouble with. Thank you.


WF 8.0.08 (Prod); WF 8.2.06 (Dev)
 
Posts: 83 | Location: OK | Registered: November 19, 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] Consecutive Days Under Budget GGSALES

Copyright © 1996-2020 Information Builders