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     ave of computed fields with across

Read-Only Read-Only Topic
Go
Search
Notify
Tools
ave of computed fields with across
 Login/Join
 
Platinum Member
posted
Hi Everyone

I am trying to do something that is giving me some grief. Here is a sample using the EMPLOYEE table...

TABLE FILE EMPLOYEE
SUM CURR_SAL ED_HRS
BY BANK_NAME BY DEPARTMENT ACROSS JOB_DESC
COMPUTE DUMMY1/D12.2M=CURR_SAL/2; AS '50% OF CUR_SAL'
COMPUTE DUMMY2/F6.2=ED_HRS/2; AS '50% OF ED_HRS'
ON BANK_NAME SUBTOTAL AVE. CURR_SAL AS 'AVE'
ON BANK_NAME SUBTOTAL AVE. ED_HRS
WHERE JOB_DESC EQ 'PROGRAMMER TRAINEE';
ON TABLE NOTOTAL
END

If you run that you will see that the Average values for the computed cols Dummy1 and Dummy2 are wrong. In fact it is summing the values and not averaging them.

So how do I get the average of those 2 computed fields? I have tried a ton of variations using RECAP and SUMMARIZE and I am not getting it. Seems like it would be so easy.

THX in advance.

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Platinum Member
posted Hide Post
Jodye,

The following works:

TABLE FILE EMPLOYEE
SUM CURR_SAL ED_HRS
COMPUTE DUMMY1/D12.2M=CURR_SAL/2; AS '50% OF CUR_SAL'
COMPUTE DUMMY2/F6.2=ED_HRS/2; AS '50% OF ED_HRS'
BY BANK_NAME BY DEPARTMENT ACROSS JOB_DESC
ON BANK_NAME SUBTOTAL AVE. CURR_SAL AS 'AVE'
ON BANK_NAME SUBTOTAL AVE. ED_HRS
ON BANK_NAME SUBTOTAL AVE. DUMMY1
ON BANK_NAME SUBTOTAL AVE. DUMMY2
WHERE JOB_DESC EQ 'PROGRAMMER TRAINEE';
ON TABLE NOTOTAL
END

In this, the two computes for DUMMY1 and DUMMY2 have been moved before the ACROSS. Therefore you can use them in the SUBTOTALs. I question why you are using ACROSS in this case. If you are just using a single JOB_DESC, then you do not need to use ACROSS.

That being said, I suspect that you want to go across multiple values and that you just included one JOB_DESC as an example. Is this correct? If so, then the sequence command comes in handy as indicated below:

TABLE FILE EMPLOYEE

SUM COMPUTE DUMMY1/D12.2M=CURR_SAL/2; AS '50% OF CUR_SAL'
COMPUTE DUMMY2/F6.2=ED_HRS/2; AS '50% OF ED_HRS'
BY BANK_NAME
BY DEPARTMENT
SUM CURR_SAL
ED_HRS
BY BANK_NAME
BY DEPARTMENT
ACROSS JOB_DESC AS ''
ON BANK_NAME SUBTOTAL AVE. CURR_SAL AS 'AVE'
ON BANK_NAME SUBTOTAL AVE. ED_HRS
ON BANK_NAME SUBTOTAL AVE. DUMMY1
ON BANK_NAME SUBTOTAL AVE. DUMMY2
WHERE JOB_DESC EQ 'PROGRAMMER TRAINEE';
ON TABLE NOTOTAL
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=BANK_NAME, SEQUENCE=1,$
TYPE=REPORT, COLUMN=DEPARTMENT, SEQUENCE=2,$
TYPE=REPORT, COLUMN=DUMMY1, SEQUENCE=98, $
TYPE=REPORT, COLUMN=DUMMY2, SEQUENCE=99, $
ENDSTYLE
END

Ken


Prod - WF 7.6.4 Unix/Solaris - Self-Service, BI Dashboard, MRE
Dev - WF 7.6.4 Unix/Solaris - Self-Service, BI Dashboard, MRE
Databases: Oracle 10g, SQL Server 2000, DB2.
 
Posts: 177 | Location: Calgary, Alberta, Canada | Registered: April 25, 2005Report This Post
Expert
posted Hide Post
I like ken's answer
but here's what is making me nuts...i've not seen this behaviour before
SUBTOTAL AVE.fieldname gives an error
but
SUBTOTAL AVE. {blank space} fieldname
works.

here's noreen's article on that blank space

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
Hi Ken and Sue

Ken your example works perfectly. It never occurred to me to move the computes before the across. And yes, the code I posted is a very simplified example of what I was trying to do.

Sue: I have seen that crazy AVE. blank space before. It is documented somewhere IIRC.

Thanks guys

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report 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     ave of computed fields with across

Copyright © 1996-2020 Information Builders