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     [CLOSED] Applying a Percentage Calculation from one Row to a Different Row

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Applying a Percentage Calculation from one Row to a Different Row
 Login/Join
 
Gold member
posted
I know someone on FocalPoint can offer a solution to this challenge. Consider the following code where I am calculating a commission payment and a threshold percentage:

  
DEFINE FILE CAR
COMMISSION/D12.2 = SALES*.035;
END

TABLE FILE CAR

SUM 
DEALER_COST
RETAIL_COST
SALES
COMMISSION
COMPUTE SALES_THRESHOLD_PCT/P8.2 = IF SALES LE 40000 THEN SALES/40000 ELSE 1;
BY COUNTRY
BY CAR

ON COUNTRY SUBTOTAL AS ''
ON COUNTRY SUBFOOT 
" "

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END



Looking at the output, how could I apply the "88%" on the Toyota Line , to all the other commissions payments in the Japan line - in this case the Datsun. So the 1505 amount would get factored by 88%.

The BMW would get reduced to 20% because of the Audi threshold percentage, and so on.

Subtotal commissions for Japan and Germany would ultimately be reduced.

Thank you greatly for your input.

Confused,
Joey Confused

This message has been edited. Last edited by: Joey Sandoval,




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Platinum Member
posted Hide Post
Multi Step procedure with hold files works every time. If I am readiing this correctly you want the lowest, non zero threshold to be applied to all of the countries products. so...

 
TABLE FILE CAR
SUM 
COMPUTE SALES_THRESHOLD_PCT/P8.2 = IF SALES LE 40000 THEN SALES/40000 ELSE 1;
BY COUNTRY
BY CAR
WHERE SALES GT 0
ON TABLE HOLD AS STEP1
END
-RUN

TABLE FILE STEP1
SUM MIN.SALES_THRESHOLD_PCT
BY COUNTRY
ON TABLE HOLD AS STEP2 FORMAT FOCUS INDEX COUNTRY
END
-RUN
 
JOIN CLEAR *

JOIN COUNTRY IN CAR TO COUNTRY IN STEP2 AS J0

DEFINE FILE CAR
COMMISSION/D12.2 = SALES*.035;
END

TABLE FILE CAR
SUM 
DEALER_COST
RETAIL_COST
SALES
COMMISSION
SALES_THRESHOLD_PCT

COMPUTE ADJ_COMMISION/P8.2 = COMMISSION * SALES_THRESHOLD_PCT;
BY COUNTRY 
BY CAR
END
-RUN
 


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
 
Posts: 132 | Location: Gadsden, Al | Registered: July 22, 2005Report This Post
Gold member
posted Hide Post
Yes, this works great - thank you. But do you think it is possible to get the same results without a hold table? I was thinking there might be a multi-verb solution as well.




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Platinum Member
posted Hide Post
FOCUS works on one Row at a time, and the only varient to that is the ability to compare the current row with the previous one with LAST. Hold files give us the ability aggregate like this without dedicating vast amounts of resources to long term storage.


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
 
Posts: 132 | Location: Gadsden, Al | Registered: July 22, 2005Report This Post
Guru
posted Hide Post
Not sure if you are trying to always get the lowest sales value but this does that:
  
DEFINE FILE CAR
COMMISSION/D12.2 = SALES*.035;
END

TABLE FILE CAR
SUM 
COMPUTE LOW_SALES_THRESHOLD_PCT/P8.2 = IF MIN.SALES LE 40000 THEN MIN.SALES/40000 ELSE 1; NOPRINT
BY COUNTRY 
SUM 
DEALER_COST
RETAIL_COST
SALES
COMMISSION
COMPUTE C_COMMISSION/P8.2 = COMMISSION * LOW_SALES_THRESHOLD_PCT;
COMPUTE SALES_THRESHOLD_PCT/P8.2 = IF SALES LE 40000 THEN SALES/40000 ELSE 1; NOPRINT
BY COUNTRY
BY CAR

ON COUNTRY SUBTOTAL AS ''
ON COUNTRY SUBFOOT 
" "

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END


You can have lots of fun with Multi-verbs, but the sometimes get weird when JOINS are involved.

Cheers

Stuart


WebFOCUS 8.2.03 (8.2.06 in testing)
 
Posts: 253 | Location: Melbourne, Australia | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
Thank you StuBouyer. Your example was the other solution I was looking for!




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report 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     [CLOSED] Applying a Percentage Calculation from one Row to a Different Row

Copyright © 1996-2020 Information Builders