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] How to calculate % of a total when using OVER, ACROSS & and a WHERE clause

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] How to calculate % of a total when using OVER, ACROSS & and a WHERE clause
 Login/Join
 
Member
posted
I hope someone out there will have a solution to this issue because I can't seem to find anything that will work the way I would like it to.

I'm creating a report that uses OVER's and ACROSS's to show several metrics over a period of time stacked on top of each other. This is working fine. My issue comes when I start breaking down the information in the same way but also include a WHERE clause to show the metrics by division. My first section has the totals.

My second section only includes one Divisions information but it's laid out exactly the same as the total section. I currently get the divsion information by duplicating the total report and including a WHERE statement in my code.This is working fine except for the fact that they want to see what percentage the Division metirc is to the TOTAL metric above.

I was able to replicate it using the CASHFLOW table in the ibisamp app folder. Hopefully you will be able to run this sample code and see what I'm dealing with.

Basically, in the first section you will find the total 'LONG_TERM_DEBT' of $7,658,360,760.

The second section is the Debt Section and as you can see,'LONG_TERM_DEBT' IS $4,196,129,400

I would like to insert a metric below called 'LONG_TERM_DEBT AS % OF TOTAL' and have the value be 55% (4,196,129,400/7,658,360,760)
but I can't figure how to get the total LONG_TERM_DEBT value to appear in my Debt Section area.

Hopefully, someone can help me with this!

Keith


Here is the code:

DEFINE FILE CASHFLOW
TOTAL_DEBT/P15.2M=LONG_TERM_DEBT + INTER_TERM_DEBT + SHRT_TERM_DEBT;
TOTAL_EQUITY/P15.2M=LONG_TERM_EQUIT+INTER_TERM_EQUIT+SHRT_TERM_EQUIT;
MONTH/M=CASH_DATE;
DEBT_OR_EQUIT/A1=IF TOTAL_DEBT GT TOTAL_EQUITY THEN 'D' ELSE 'E';
END

TABLE FILE CASHFLOW
PRINT *
TOTAL_DEBT
TOTAL_EQUITY
MONTH
DEBT_OR_EQUIT
ON TABLE HOLD AS HOLD1
END

TABLE FILE HOLD1
SUM
LONG_TERM_DEBT OVER
INTER_TERM_DEBT OVER
SHRT_TERM_DEBT OVER
TOTAL_DEBT OVER
LONG_TERM_EQUIT OVER
INTER_TERM_EQUIT OVER
SHRT_TERM_EQUIT OVER
TOTAL_EQUITY
ACROSS MONTH
HEADING
"TOTAL Report"
END


TABLE FILE HOLD1
SUM
LONG_TERM_DEBT OVER
INTER_TERM_DEBT OVER
SHRT_TERM_DEBT OVER
TOTAL_DEBT OVER
LONG_TERM_EQUIT OVER
INTER_TERM_EQUIT OVER
SHRT_TERM_EQUIT OVER
TOTAL_EQUITY
ACROSS MONTH
WHERE DEBT_OR_EQUIT EQ 'D'
HEADING
"DEBT Only Report"
END

TABLE FILE HOLD1
SUM
LONG_TERM_DEBT OVER
INTER_TERM_DEBT OVER
SHRT_TERM_DEBT OVER
TOTAL_DEBT OVER
LONG_TERM_EQUIT OVER
INTER_TERM_EQUIT OVER
SHRT_TERM_EQUIT OVER
TOTAL_EQUITY
ACROSS MONTH
WHERE DEBT_OR_EQUIT EQ 'E'
HEADING
"EQUITY Only Report"
END

This message has been edited. Last edited by: Kathleen Butler,


WebFOCUS 8.104
Windows, All Outputs
 
Posts: 28 | Location: Holland, MI USA | Registered: September 30, 2010Report This Post
Virtuoso
posted Hide Post
Did you try to search on multiverb
that would solve your problem




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
Virtuoso
posted Hide Post
Using your example:

  
-* File kfreers01.fex
DEFINE FILE CASHFLOW
TOTAL_DEBT/P15.2M=LONG_TERM_DEBT + INTER_TERM_DEBT + SHRT_TERM_DEBT;
TOTAL_EQUITY/P15.2M=LONG_TERM_EQUIT+INTER_TERM_EQUIT+SHRT_TERM_EQUIT;
MONTH/M=CASH_DATE;
DEBT_OR_EQUIT/A1=IF TOTAL_DEBT GT TOTAL_EQUITY THEN 'D' ELSE 'E';
END

TABLE FILE CASHFLOW
PRINT *
TOTAL_DEBT
TOTAL_EQUITY
MONTH
DEBT_OR_EQUIT
ON TABLE HOLD AS HOLD1
END

TABLE FILE HOLD1
SUM
LONG_TERM_DEBT NOPRINT
INTER_TERM_DEBT NOPRINT
SHRT_TERM_DEBT NOPRINT
TOTAL_DEBT NOPRINT
LONG_TERM_EQUIT NOPRINT
INTER_TERM_EQUIT NOPRINT
SHRT_TERM_EQUIT NOPRINT
TOTAL_EQUITY NOPRINT
BY MONTH
SUM 
LONG_TERM_DEBT  
INTER_TERM_DEBT  
SHRT_TERM_DEBT  
TOTAL_DEBT  
LONG_TERM_EQUIT  
INTER_TERM_EQUIT  
SHRT_TERM_EQUIT  
TOTAL_EQUITY
COMPUTE 
PCT_LTD/D7.2%=C9/C1 * 100;
PCT_ITD/D7.2%=C10/C2 * 100;
PCT_STD/D7.2%=C11/C3 * 100;
PCT_TTD/D7.2%=C12/C4 * 100;
PCT_LTE/D7.2%=C13/C5 * 100;
PCT_ITE/D7.2%=C14/C6 * 100;
PCT_STE/D7.2%=C15/C7 * 100;
PCT_TTE/D7.2%=C16/C8 * 100;
BY MONTH
BY DEBT_OR_EQUIT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HOLD2
END
-RUN
DEFINE FILE HOLD2
DOE/A8=IF DEBT_OR_EQUIT EQ 'D' THEN 'Debt' ELSE 'Equity';
END
TABLE FILE HOLD2
SUM
LONG_TERM_DEBT OVER
PCT_LTD OVER
INTER_TERM_DEBT OVER
PCT_ITD OVER
SHRT_TERM_DEBT OVER
PCT_STD OVER
TOTAL_DEBT OVER
PCT_TTD OVER
LONG_TERM_EQUIT OVER
PCT_LTE OVER
INTER_TERM_EQUIT OVER
PCT_ITE OVER
SHRT_TERM_EQUIT OVER
PCT_STE OVER
TOTAL_EQUITY OVER
PCT_TTE
ACROSS MONTH
BY DOE NOPRINT PAGE-BREAK
HEADING
"<DOE Only Report"
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
Danny,

Your solution worked great for what I needed to show on my report.

Thanks Again,

Keith


WebFOCUS 8.104
Windows, All Outputs
 
Posts: 28 | Location: Holland, MI USA | Registered: September 30, 2010Report 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] How to calculate % of a total when using OVER, ACROSS & and a WHERE clause

Copyright © 1996-2020 Information Builders