Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate percentage in script

Hi all,

I would calculate a percentage to a key figure "turnover" based on two attributes in a qv-script. E.g.:

Attribute_1     Attribute_2     KF _1         KF_2

================================

SubSid          Plant            Turnover      Factor

100                1                    100          =100/400 =0.25

100                2                    300          = 300/400 = 0.75

120                5                    150          = 150/700 = 0.21

120                8                    550          = 550/700 = 0.79

So, how can I calculate the key figure "Factor" on the script level?

Thanks for help,

Val.

1 Reply
Clever_Anjos
Employee
Employee

something like

left join (yourtable)

LOAD

SubSid,

sum(  Turnover      ) as TurnoverAggr

resident yourtable

group by    SubSid;


LOAD

  SubSid,

  Plant,

  TurnOver,

  TurnOver/TurnoverAggr as Percentage

resident yourtable;

drop table yourtable;