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.
I would like to have a variance appear on a second level ACROSS hierarchy.
DEFINE FILE GGSALES
YEAR/YY=DATE;
END
TABLE FILE GGSALES
SUM
GGSALES.SALES01.DOLLARS
BY GGSALES.SALES01.CATEGORY
ACROSS LOWEST GGSALES.SALES01.REGION
COMPUTE VAR/D12.2=(C2-C1);
ACROSS LOWEST GGSALES.SALES01.YEAR
ON TABLE NOTOTAL
END
It doesn't matter where I put the COMPUTE line I get the same results. The VAR comes at the end but I want the VAR to appear in each REGION.
ThanksThis message has been edited. Last edited by: Trudy,
DEFINE FILE GGSALES
YEAR/A4=EDIT(DATE,'9999');
END
TABLE FILE GGSALES
SUM
GGSALES.SALES01.DOLLARS
COMPUTE VAR/I08=IF LAST REGION EQ REGION THEN DOLLARS - LAST DOLLARS ELSE 0;
BY GGSALES.SALES01.CATEGORY
BY LOWEST GGSALES.SALES01.REGION
BY LOWEST GGSALES.SALES01.YEAR
ON TABLE HOLD AS SALES
END
TABLE FILE SALES
SUM
VAR AS DOLLARS
COMPUTE YEAR/A4='VAR';
BY CATEGORY
BY REGION
WHERE YEAR EQ '1997'
ON TABLE HOLD AS VAR
END
TABLE FILE SALES
SUM
DOLLARS
BY CATEGORY
ACROSS LOWEST REGION
ACROSS LOWEST YEAR
ON TABLE NOTOTAL
MORE
FILE VAR
END
This message has been edited. Last edited by: Frans,
There are probably several different ways to meet your requirements.
For these types of requirements I like to sometimes separate the data extraction/summarization/calculations from the report presentation to the user.
-DEFAULTH &LASTYEAR = 1996
-DEFAULTH &CURRENTYEAR = 1997
SET PAGE = OFF
SET ACROSSLINE = SKIP
SET ACROSSTITLE = SIDE
-*
-* Bucket Incoming Data.
-*
DEFINE FILE GGSALES
YEAR/YY=DATE;
YEAR1/D12.2 = IF YEAR EQ &LASTYEAR THEN DOLLARS ELSE 0;
YEAR2/D12.2 = IF YEAR EQ &CURRENTYEAR THEN DOLLARS ELSE 0;
END
TABLE FILE GGSALES
SUM
YEAR1
YEAR2
COMPUTE
VAR/D12.2 = YEAR1 - YEAR2;
BY GGSALES.SALES01.CATEGORY
BY GGSALES.SALES01.REGION
ON TABLE HOLD
END
-RUN
-*
-* Report Presentation.
-*
TABLE FILE HOLD
"Car Sales"
"&LASTYEAR v. &CURRENTYEAR"
SUM YEAR1 AS '&LASTYEAR'
YEAR2 AS '&CURRENTYEAR'
VAR AS 'Variance'
BY CATEGORY
ACROSS REGION AS 'Region:'
ON TABLE SET STYLE *
INCLUDE=jellybean_combo.sty, $
TYPE = TITLE, JUSTIFY = CENTER,$
TYPE = ACROSSTITLE, JUSTIFY = RIGHT,$
TYPE = ACROSSVALUE, JUSTIFY = CENTER,$
ENDSTYLE
END
This message has been edited. Last edited by: David Briars,
Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
David Briars, I like your separation of the Extract and Display. For Trudy: You can add the Column and Row Totals as well right after the ACROSS statement, as follows:
ON TABLE COLUMN-TOTAL AND ROW-TOTAL
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
Thanks everyone I used David's solution. I did try Frans solution but had an issue with the format of the field that was being totaled that I couldn't figure out.