Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
agaetisproject
New 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

Tags (1)
1 Reply
MVP
MVP

Re: Apply a risk factor on inpt metrics

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;

Community Browser