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]Divide by columns from 2 separate rows

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Divide by columns from 2 separate rows
 Login/Join
 
Silver Member
posted
My code will generate the TotalExpense and TotalIncome rows, but I am having a problem generating the Percent row.
I need Percent to equal TotalExpense / TotalIncome

Account Week1 Week 2 Week 3 Week 4 Week 5 MTD Total
TotalExpense 49,919 43,234 55,114 39,699 54,285 242,252
TotalIncome 102,785 83,001 80,946 88,911 88,911 444,554
Percent 0.485664251 0.520885291 0.680873669 0.446502682 0.610554375 0.544932674 <-- trying to calculate this row

My code...
TABLE FILE VWINCOMEEXPENSE
SUM
VWINCOMEEXPENSE.VWINCOMEEXPENSE.WEEK1
VWINCOMEEXPENSE.VWINCOMEEXPENSE.WEEK2
VWINCOMEEXPENSE.VWINCOMEEXPENSE.WEEK3
VWINCOMEEXPENSE.VWINCOMEEXPENSE.WEEK4
VWINCOMEEXPENSE.VWINCOMEEXPENSE.WEEK5
VWINCOMEEXPENSE.VWINCOMEEXPENSE.MTDTOTAL
BY VWINCOMEEXPENSE.VWINCOMEEXPENSE.ACCOUNTTYPE AS ''
WHERE VWINCOMEEXPENSE.VWINCOMEEXPENSE.ACCOUNTTYPE EQ 'TotalIncome' OR 'TotalExpense';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

Using the CAR database as an example I would need 'TOTAL' to be 'PERCENT' with the calculation being the 'AUDI' RETAIN_COST divided by the 'BMW' RETAIN_COST.
TABLE FILE CAR
SUM
CAR.BODY.RETAIL_COST
BY CAR.COMP.CAR
WHERE CAR.COMP.CAR EQ 'AUDI' OR 'BMW';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
ENDSTYLE
END

Thanks,
David

This message has been edited. Last edited by: David M,


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
 
Posts: 34 | Location: Southern New Jersey | Registered: January 24, 2017Report This Post
Virtuoso
posted Hide Post
Try calculating each column based on the value of the car first and then use them in your percent calculation. Something like this:

DEFINE FILE CAR
AUDI_RC/D12.2=IF CAR EQ 'AUDI' THEN RCOST ELSE 0;
BMW_RC/D12.2=IF CAR EQ 'BMW' THEN RCOST ELSE 0;
END
TABLE FILE CAR
SUM
COMPUTE PERC/D12.2%=TOT.AUDI_RC/TOT.BMW_RC * 100; NOPRINT
CAR.BODY.RETAIL_COST
BY CAR.COMP.CAR
WHERE CAR.COMP.CAR EQ 'AUDI' OR 'BMW';
ON TABLE FOOTING
"<PERC"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
ENDSTYLE
END


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
Your suggestion worked, Thanks


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
 
Posts: 34 | Location: Southern New Jersey | Registered: January 24, 2017Report 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]Divide by columns from 2 separate rows

Copyright © 1996-2020 Information Builders