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     Computing variances over an Across

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Computing variances over an Across
 Login/Join
 
Gold member
posted
I'm having trouble with my procedure. I'm trying to compute the variance between the average unit price from this year over last year. Here is my code:

 TABLE FILE SALES_COMPLETE_US

SUM 
     COMPUTE AVG_PRICE/D12.2 = SALES_COMPLETE_US.SALES_COMPLETE_US.EXTENDED_FET_PRICE / SALES_COMPLETE_US.SALES_COMPLETE_US.QTY;
BY 'SALES_COMPLETE_US.SALES_COMPLETE_US.DIVISION'
ACROSS 'J0.PRODUCTS_US.BRAND_GROUP' AS ' '
ACROSS 'SALES_COMPLETE_US.SALES_COMPLETE_US.GL_DT_FISCAL_YEAR' AS ' '
-*COMPUTE PCT_CHG/D12.2 = (C2-C1)/C2*100;
HEADING
""
FOOTING
""
WHERE (( XDATE GE '&BeginDate2' ) AND ( XDATE LE '&EndDate2' )) OR (( XDATE GE '&PrevBeginDate' ) AND ( XDATE LE '&PrevEndDate' )); 


With this code, I get a nice report - 5 columns across that gives me the average unit price for 2010 and 2011 for both of my brand groups. As soon as I add the pct_chg column, that's where it goes awry. I've tried placing the compute in different places in the code, but still not getting the right results. It either calculates wrong or it inserts the pct_chg after each column, instead of a column after each brand group.

Hope my explanation isn't too convoluted. Thanks for your help.


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
 
Posts: 90 | Registered: November 03, 2009Report This Post
Virtuoso
posted Hide Post
I think you have 2 (or more) options to solve this

1) first put the result in a hold file and do the pct_change calculation before you do the across command.

 TABLE FILE SALES_COMPLETE_US

SUM 
     COMPUTE AVG_PRICE/D12.2 = SALES_COMPLETE_US.SALES_COMPLETE_US.EXTENDED_FET_PRICE / SALES_COMPLETE_US.SALES_COMPLETE_US.QTY;
BY 'SALES_COMPLETE_US.SALES_COMPLETE_US.DIVISION'
BY 'J0.PRODUCTS_US.BRAND_GROUP' AS ' '
BY 'SALES_COMPLETE_US.SALES_COMPLETE_US.GL_DT_FISCAL_YEAR' AS ' '
COMPUTE PCT_CHG/D12.2 = (AVG_PRICE- LAST AVG_PRICE)/(LAST AVG_PRICE)*100;
ON TABLE HOLD
END
etc...


2) use of a multiverb report.
this last is not easy to explain, so try the first one.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Gold member
posted Hide Post
I didn't get the notification that anyone responded, so thanks Frank! I tried the code you suggested, but when I try to open it in report painter, it literally changes my code. I did it twice to make sure I'm not going nuts. But here is what it changed it to:
ON SALES_COMPLETE_US.SALES_COMPLETE_US.GL_DT_FISCAL_YEAR RECAP 
PCT_CHG/D12.2 = ( AVG_PRICE - LAST AVG_PRICE ) / ( LAST AVG_PRICE ) * 100;
  


Maybe I'll have to stay in the Text to complete this report?


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
 
Posts: 90 | Registered: November 03, 2009Report 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     Computing variances over an Across

Copyright © 1996-2020 Information Builders