Focal Point
[SOLVED] SALES TOTAL AND BY HIGHEST 3

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

May 03, 2010, 02:30 PM
fenwicee
[SOLVED] SALES TOTAL AND BY HIGHEST 3
I'm trying to create what I thought would be a fairly simple report. All I am trying to do is show 5 columns: customer, sales for entire period and then sales for the latest three days. I have tried multiple things but I cannot seem to get this to work. Any suggestions?

This message has been edited. Last edited by: Kerry,
May 03, 2010, 02:50 PM
GinnyJakes
Have you tried a multi-verb request? I don't know what your period is but let's say that it is the current month. Here is some sample code, untested.
-SET &TESTDATE=20100429;
-SET &DAY3=AYMD(&TESTDATE,-3,'I8YYMD');
-TYPE &DAY3
-SET &CURRPER=EDIT(&TESTDATE,'999999');
-SET &BEGDT=&TESTDATE || '01';
DEFINE FILE whatever
DAYSALES3/D20=IF SALESDATE EQ &DAY3 THEN SALES ELSE 0;
DAYSALES2/D20=IF SALESDATE EQ AYMD(&DAY3,1,'I8YYMD') THEN SALES ELSE 0;
DAYSALES1/D20=IF SALESDATE EQ AYMD(&DAY3,2,'I8YYMD') THEN SALES ELSE 0;
END
TABLE FILE whatever
SUM SALES
BY CUSTOMER
SUM DAYSALES3 DAYSALES2 DAYSALES1
BY CUSTOMER
WHERE SALESDATE GE &BEGDT
END

I think you will have to tweak the Dialogue Manager code a bit to suit your needs and to handle your periods and month changes but this should give you an idea of what you need to do.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
May 03, 2010, 02:56 PM
Francis Mariani
Or this:

SET ASNAMES=ON
SET HOLDFORMAT=ALPHA
SET HOLDLIST=PRINTONLY

TABLE FILE GGORDER
SUM
QUANTITY AS 'TOT_QTY'
BY PRODUCT_CODE

SUM
QUANTITY
BY PRODUCT_CODE
BY HIGHEST 3 ORDER_DATE

ON TABLE HOLD
END

TABLE FILE HOLD
SUM TOT_QTY
BY PRODUCT_CODE

SUM QUANTITY
BY PRODUCT_CODE
ACROSS ORDER_DATE
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
May 06, 2010, 05:08 PM
fenwicee
I was actually able to get it to work using the DEFINE method.


DEFINE FILE SQLOUT
SALES0/D12.2=IF DATE1 EQ TO_DATE THEN SALES ELSE 0;
SALES1/D12.2=IF DATE1 EQ TO_DATE -1 THEN SALES ELSE 0;
SALES2/D20.2=IF DATE1 EQ TO_DATE - 2 THEN SALES ELSE 0;
END

TABLE FILE SQLOUT
SUM
SALES
SALES0
SALES1
SALES2
BY CUSTOMER


But now I am struggling with something new on this report. The TO_DATE field is a parameter in the SQL. I need the column heading on the SALES1 & SALES2 columns to reference the date they refer to. Any suggestions on this?
May 06, 2010, 05:41 PM
Francis Mariani
That's what the ACROSS is for.


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
May 12, 2010, 03:19 PM
fenwicee
That wasn't working. I had to go back and use a series of SET commands to end up getting it to work. thanks all though.
May 12, 2010, 03:28 PM
Francis Mariani
Are we not curious about this "series of SET commands"?


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