Focal Point
[SOLVED] Recomputing computed column as percent

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9217012766

February 10, 2014, 11:19 AM
Greg
[SOLVED] Recomputing computed column as percent
I currently have this compute which compares a headcount from the previous year to the current year.

 COMPUTE inc_dec_oct/I3 = HEAD_COUNT.OCT_13 - HEAD_COUNT.OCT_12; AS Inc/Dec  


Displays this:

Job Title Oct 12 Oct 13 Inc/Dec

Cook 5 3 -2

I would like to add a percent column to get this:

Job Title Oct 12 Oct 13 Inc/Dec Percent

Cook 5 3 -2 (40%)

Adding this gives me a percent but its backwards. I am getting 60% not (40%)

 COMPUTE oct_perct/I3% = (HEAD_COUNT.OCT_12/HEAD_COUNT.OCT_13) * 100; AS Percent  


Also the headcount can go up so maybe I need a DEFINE with some IF GT or IF LT to get the proper percentage?

This message has been edited. Last edited by: Greg,


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

February 10, 2014, 12:46 PM
Danny-SRL
quote:
COMPUTE oct_perct/I3% = (HEAD_COUNT.OCT_12/HEAD_COUNT.OCT_13) * 100; AS Percent


This shows the percentage of oct_12 in oct_13. What you say you say you want is the decrease.
So use:
  
COMPUTE oct_perct/I3% = ((HEAD_COUNT.OCT_13 -HEAD_COUNT.OCT_12)/HEAD_COUNT.OCT_13) * 100; AS Percent

However you will have to take into account the difference between decrease and increase.


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

February 10, 2014, 01:09 PM
Greg
quote:

However you will have to take into account the difference between decrease and increase.


I think I will a DEFINE to determine GT and LT.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL