Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
I
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;