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] Difference between two columns over an across field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Difference between two columns over an across field
 Login/Join
 
Platinum Member
posted
Hi i am trying to achieve the report output in below format.

  
			        2016	2017    Diff
Product1			167	265	98
Product2			3,053	3,083	30
Product3			4	7	3
product4			63	51	-12
product5			67	117	50
product6			591	245	-346


I am unable to create a define field for finding difference as the sales count field is coming as two columns across years.
How can i achieve this.

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


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
This is one option, other such as MacGyver technique may also be applicable

DEFINE FILE GGSALES
YR /YY    = DATE;
END
TABLE FILE GGSALES
SUM DOLLARS AS 'VAL'
BY CITY
BY YR
BY TOTAL COMPUTE ROWLABEL/A10 = EDIT(YR);
ON TABLE HOLD AS EXTDATA
END
-RUN

DEFINE FILE EXTDATA
SALES1 /D6 = IF YR EQ 1996 THEN VAL ELSE 0;
SALES2 /D6 = IF YR EQ 1997 THEN VAL ELSE 0;
END
TABLE FILE EXTDATA
SUM COMPUTE VAL/I08 = (SALES2 - SALES1);
BY CITY
BY TOTAL COMPUTE YR/YY = 9999;
BY TOTAL COMPUTE ROWLABEL/A10 = 'Diff';
ON TABLE HOLD AS DIFFDATA
END
-RUN

TABLE FILE EXTDATA
SUM VAL AS ''
BY CITY AS ''
ACROSS YR NOPRINT
ACROSS ROWLABEL AS ''
MORE
FILE DIFFDATA
END
-RUN


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
Expert
posted Hide Post
If that is indeed all you need, a simple table request will suffice.

TABLE FILE srajeevan
SUM VALUE AS ''
 BY PRODUCT AS ''
ACROSS YEAR AS ''
COMPUTE Diff/D20 = C2 - C1;
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  grid=off, $
ENDSTYLE
END


Using data built from the following. I can only assume that this is similar structure to your data.

EX -LINES * EDAPUT MASTER,srajeevan,CV,FILE
FILENAME=srajeevan, SUFFIX=FOCUS
SEGNAME=SEG01, $
FIELDNAME=PRODUCT, ,A20    ,A20  ,$
FIELDNAME=YEAR,    ,I4     ,I4   ,$
FIELDNAME=VALUE,   ,D20  ,A20  ,$
EDAPUT*
-RUN
CREATE FILE srajeevan
MODIFY FILE srajeevan
FREEFORM PRODUCT YEAR VALUE
DATA
Product1,2016,167,$
Product1,2017,265,$
Product2,2016,3053,$
Product2,2017,3083,$
Product3,2016,4,$
Product3,2017,7,$
product4,2016,63,$
product4,2017,51,$
product5,2016,67,$
product5,2017,117,$
product6,2016,591,$
product6,2017,245,$
END


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
Virtuoso
posted Hide Post
Good One Tony


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
  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] Difference between two columns over an across field

Copyright © 1996-2020 Information Builders