1 Reply Latest reply: May 3, 2016 9:42 AM by Stefan Wühl RSS

    Apply a risk factor on inpt metrics

    Jeff Robertz

      Dear all,

       

      I would like to apply a risk factor on metrics.

      I load two tables: Input and RiskFactors.

      As an output, I would like to get the NewInput.

      With limited script talent, I am struggling to get this to work.

      I see that preceding load may be useful here but can't succeed.

      Could anyone help me solve this?

       

      Many thanks!

      IScreenshot 2016-05-03 12.33.26.png

        • Re: Apply a risk factor on inpt metrics
          Stefan Wühl

          You can use a mapping table to map the risk factors to your input table, then aggregate the values:

           

          Input:
          LOAD * INLINE [
          Category, Monthly cost
          Personnel, 100
          Travel, 20
          Equipment, 30
          Risk, 10
          ];
          
          RiskFactors:
          Mapping
          LOAD * INLINE [
          Category, Risk factor
          Personnel, 10%
          Travel, 5%
          Equipment, 3%
          ];
          
          
          RiskTable:
          Concatenate (Input)
          LOAD 'Risk' as Category, Sum(Risks) as [Monthly cost];
          LOAD [Monthly cost] * ApplyMap('RiskFactors',Category,1) as Risks
          Resident Input;
          
          
          RESULT:
          NoConcatenate
          LOAD Category, Sum([Monthly cost]) AS [Monthly cost]
          Resident Input
          Group BY Category;
          
          
          Drop table Input;