Focal Point
[CLOSED] Previous years total as baseline

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

February 23, 2017, 11:01 AM
Pondog
[CLOSED] Previous years total as baseline
I'm working on fex for a graph in which the previous years summed ACTUAL is used as a Baseline which is then used to calculate Targets for this years Year to Date (YTD) total. I've tried DEFINE and COMPUTE but can't seem to get either to work. Part of my problem is that when I get the data and try to put it in the graph, the Baseline data is from last year and the graph is for the current YTD, so, either the graph shows everything from last year AND this year and the Baseline is visible, or the graph only shows this year (YTD) and the Baseline disappears. I've looked into using MATCH FILE but am not sure if this is the right course of action. I think I may be making this more difficult than it should be. Here is what I'm working with.

The Baseline is the summed ACTUAL from 201601-201611 (7,108,289)
The YTD is the summed ACTUAL from 201701 - Present

|FYFM | FYMTH | ACTUAL 

201601| Oct   |1,090,513
201602| Nov   |1,009,781
201603| Dec   |921,291
201604| Jan   |839,813
201605| Feb   |745,650
201606| Mar   |650,900
201607| Apr   |557,191
201608| May   |464,314
201609| Jun   |371,134
201610| Jul   |275,113
201611| Aug   |182,589
201612| Sep   |132,543
201701| Oct   |358,743 
201702| Nov   |266,805 
201703| Dec   |177,579 
201704| Jan   |88,309 


DEFINE FILE TABLENAME
BASELINE/D20 = IF FYFM GE '201601' AND FYFM LE '201611' THEN TABLENAME.ACTUAL
                       ELSE 0 ;
TARGET1_ARRIVES/D12.2 = BASELINE * 1.01 ;
TARGET2_ARRIVES/D12.2 = BASELINE * 1.04 ;
TARGET3_ARRIVES/D12.2 = BASELINE * 1.07 ;
YTD_ARR/D10CB = IF FYFM GE 201701 THEN TABLENAME.ACTUAL ;

END
-RUN

TABLE FILE TABLENAME
SUM
  BASELINE_ARRIVES
  TARGET1_ARRIVES
  TARGET2_ARRIVES
  TARGET3_ARRIVES
  YTD_ARR


ON TABLE NOTOTAL
ON TABLE HOLD AS HOLD1
END  

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


WebFOCUS 8.1.05
Windows, All Outputs
February 23, 2017, 01:42 PM
FP Mod Chuck
Please try the following

DEFINE FILE TABLENAME
BASELINE/D12.2=IF FYFM GE 201601 AND FYFM LE 201612 THEN ACTUAL ELSE 0;
YTD_ARR/D12.2=IF FYFM GE 201701 THEN ACTUAL ELSE 0;
END
TABLE FILE TABLENAME
SUM
BASELINE
YTD_ARR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS baseline FORMAT ALPHA
END
-RUN
DEFINE FILE BASELINE
TARGET1_ARRIVES/D12.2=BASELINE * 1.01;
TARGET2_ARRIVES/D12.2=BASELINE * 1.04;
TARGET3_ARRIVES/D12.2=BASELINE * 1.07;
END
-*IA_GRAPH_BEGIN
-*Do not delete or modify the comments below
*-INTERNAL_COMMENT LINE#0$PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8IS0tMS4wLS0+PFJvb3QgdmVyc2lvbj0iMS4xIj4NCiAgICA8T2JqZWN0IG9iamVjdElkPSJHTE9CQUwiPg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iU2FtcGxlRGF0YSIgdHlwZT0iamF2YS5sYW5nLkJvb2xlYW4iPmZhbHNlPC9Qcm9wZXJ0eT4NCiAgICAgICAgPFByb3BlcnR5IG5hbWU9Ikdsb2JhbFJlY29yZExpbWl0IiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj41MDA8L1Byb3BlcnR5Pg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iR2xvYmFsUnVuUmVjb3JkTGltaXQiIHR5cGU9ImphdmEubGFuZy5TdHJpbmciPjA8L1Byb3BlcnR5Pg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iR2xvYmFsT3B0aW1pemF0aW9uIiB0eXBlPSJqYXZhLmxhbmcuQm9vbGVhbiI+dHJ1ZTwvUHJvcGVydHk+DQogICAgICAgIDxQcm9wZXJ0eSBuYW1lPSJmaWVsZ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MENT LINE#1$bnRyeSB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj5hY3R1YWxzPC9FbnRyeT4NCiAgICAgICAgPC9Qcm9wZXJ0eT4NCiAgICAgICAgPFByb3BlcnR5IG5hbWU9Im1ldGFkYXRhVmlld0FzIiB0eXBlPSJNYXAiPg0KICAgICAgICAgICAgPEVudHJ5IGtleT0iYWN0dWFscyIgdHlwZT0iamF2YS5sYW5nLlN0cmluZyI+TWV0YURhdGFUcmVlLlZJRVdfRElNUzwvRW50cnk+DQogICAgICAgIDwvUHJvcGVydHk+DQogICAgICAgIDxQcm9wZXJ0eSBuYW1lPSJlbmFibGVQcmV2aWV3IiB0eXBlPSJqYXZhLmxhbmcuQm9vbGVhbiI+dHJ1ZTwvUHJvcGVydHk+DQogICAgPC9PYmplY3Q+DQo8L1Jvb3Q+DQo=
-*Do not delete or modify the comments above
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE BASELINE
-* Created by Info Assist for Graph
SUM
TARGET1_ARRIVES
TARGET2_ARRIVES
TARGET3_ARRIVES
YTD_ARR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 0
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
February 23, 2017, 02:42 PM
Pondog
Hey Chuck, thanks for the feedback. I still end up with the scenario of either it shows all the years and a Baseline or only the YTD and no baseline. The only difference is that the Baseline isn't showing at all.

Somehow I've got to get my Baseline and Targets to be straight lines across the graph with my ACTUALS as the only line that changes.


WebFOCUS 8.1.05
Windows, All Outputs
February 23, 2017, 05:14 PM
FP Mod Chuck
Can you send a screen print of what you are seeing when running the procedure to my e-mail. chuck_wolff@ibi.com


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
February 24, 2017, 08:23 AM
Danny-SRL
Pondog,

I copied your data into one column of an XL and defined a master for that column:
  
FILENAME=PONDOG, SUFFIX=DIREXCEL,
 DATASET=c:\ibi\apps\focalpoint\pondog.xlsx, $
  SEGMENT=PONDOG, SEGTYPE=S0, $
    FIELDNAME=PONDOG, ALIAS=PONDOG, USAGE=A24, ACTUAL=A24,
      MISSING=ON,
      TITLE='PONDOG', $


I then extracted FYFM and ACTUAL from the single field PONDOG:
  
DEFINE FILE PONDOG
FYFM/A6=EDIT(PONDOG,'999999');
ACTUAL/I9=  EDIT(STRIP(9,GETTOK(PONDOG, 24, 3, '|', 9, 'A9'), ',', 'A9'));
-*
BASELINE/D20 = IF FYFM GE '201601' AND FYFM LE '201611' THEN ACTUAL
                       ELSE 0 ;
TARGET1_ARRIVES/D12.2 = BASELINE * 1.01 ;
TARGET2_ARRIVES/D12.2 = BASELINE * 1.04 ;
TARGET3_ARRIVES/D12.2 = BASELINE * 1.07 ;
YTD_ARR/D10CB = IF FYFM GE '201701' THEN ACTUAL ELSE 0 ;
END

Notice: For YTD_ARR, quotes about 201701 and the ELSE to complete the IF.

Finally I produce output (WITHOUT FORMATTING FOR BREVITY):
  
GRAPH FILE PONDOG
SUM
  BASELINE
  TARGET1_ARRIVES
  TARGET2_ARRIVES
  TARGET3_ARRIVES
  YTD_ARR
END


Is this what you want to show in your graph?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

February 24, 2017, 10:12 AM
FP Mod Chuck
Thanks for the e-mail. In looking at what you sent and what you want to accomplish in my mind the data does not lend itself to that. The targets based on the baseline and the ytd_arr are a single point in time and I don't see how they can be a line across time for the 2017 values. Hopefully someone else has an idea of how to accomplish this.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats