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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.

I am near the end of a project. I have two final components to solve. I am hoping someone on the forum might have an idea as to how to solve on of them.

Here is my question: I have a rolling five years of data. My users select the last year and then they get to see that year, plus the previous five years.

At the end, we want to calculate two percentages of change.

The first one (PCTCHG1F) is basically the last year minus the previous year. If either field is 0, then it is masked and the formula provides a dash. Otherwise, the calculated percentage (from an earlier table) displays nicely.

That formula works beautifully.

The second formula (PCTCHG5F) does not work as well. It should be the current year minus the first year. If either the values of the first year and last year result in zeroes, they are masking appropriately with the caret. However, if the first year has a value but the last year is masked with a caret, the formula should behave just like the first formula and result in a dash. It's not.

I've tried using FST.

Is there a better way to do this? As an aside, I separated the COMPUTE statements below for ease in reading.

-*Note the LAST takes into account the value for the max year less one. In other words, it returns the previous year's data correctly.

COMPUTE PCTCHG1ALPHA/A15=FTOA(PCTCHG1,'(D11.1%)','A15'); COMPUTE PCTCHG1F/A15 =IF LAST ALPHAC_F EQ '^' THEN '-' ELSE IF ALPHAC_F EQ '^' THEN '-' ELSE PCTCHG1ALPHA;

-*Is there a better way to account for the first instance of ALPHA_C_F? I am getting a value of 0% when the first value is masked. I want a dash when either the first year or last year is masked. I only want percentages when both have values.

COMPUTE PCTCHG5ALPHA/A15=FTOA(PCTCHG5,'(D11.1%)','A15'); COMPUTE PCTCHG5F/A15 =IF FST.ALPHAC_F EQ '^' THEN '-' ELSE IF ALPHAC_F EQ '^' THEN '-' ELSE PCTCHG5ALPHA;This message has been edited. Last edited by: JulieA,

An option is also not to try to do all in one step.

First, create the data as you need but with real numbers. Even if you have too many columns and non desired one, it's not important since it's an temp-step. Second, use step one result to then add the masking option and only keep desired columns.

Often, trying to do all in one step make it more confusing and difficult to accomplish.

WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007

Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013

As to the suggestions: In the end, my solution utilized a missing component higher up in my procedure and then I continued it down below in the section I was asking about.

Again, thank you both. Something each of you said made the light bulb go off in my headThis message has been edited. Last edited by: JulieA,