Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
agaetisproject
Contributor III
Contributor III

Apply a risk factor on inpt metrics

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

1 Reply
swuehl
MVP
MVP

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;