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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamically calculate /apply Formula to field (SCRIPT)

Hi Guys,

The table below:

Components14:

LOAD

     _ComponentKey2

     ,KPI_Formula_byComponent

     ,61

     ,62

     ,65

     ,66

FROM $(vModified)Components15.qvd (qvd);

as the following values:

    

_ComponentKey2KPI_Formula_byComponent61656266
26 . -1 . 6 . 20150301(61/65) + (62/66)61656266

I need to create a new field containing the RESULT of the formula in field "KPI_Formula_byComponent". Please note the formula may change and I need to "follow" the changes dynamically.

Using the following the issue is solved!

     ,Evaluate(KPI_Formula_byComponent) AS Calculated_KPI

Aldo.

Message was edited by: Aldo Liaks Solved.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Thanks for your answer.

The function "Evaluate" solves the issue.

     ,Evaluate(KPI_Formula_byComponent) AS Calculated_KPI

Aldo.

View solution in original post

2 Replies
MK_QSL
MVP
MVP

You can use preceding load as below;

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

Components14:

Load

     *,

     (61/65) + (62/66) as KPI_Formula_byComponent;

LOAD

     _ComponentKey2

    ,YourExpression as 61

     ,YourExpression as 62

     ,YourExpression as 65

     ,YourExpression as 66

FROM $(vModified)Components15.qvd (qvd);

Not applicable
Author

Hi,

Thanks for your answer.

The function "Evaluate" solves the issue.

     ,Evaluate(KPI_Formula_byComponent) AS Calculated_KPI

Aldo.