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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
smiling_cheetah
Creator
Creator

Interpret field values as formulas

Hello everyone, 
I'm trying to calculate a field in script based on the formula written in another field, and would really appreciate your help 

The table looks like this: 

Tab:
Load * inline [ id, field1, field2, formula 1, 100, 150, field1*1.2 2, 200, 220, field2*1.5 3, 300, 350, field1*0.4 ];

As an outcome I need the table to have an additional field: 

Tab:
Load * inline [
id, field1, field2, formula, result
1, 100, 150, field1*1.2, 120
2, 200, 220, field2*1.5, 330
3, 300, 350, field1*0.4, 120
];

How do I make the field "formula" be interpreted as an expression? 

I tried using 

1) $(formula) as result

2) $(=formula) as result

3) adding equal sign to the field values (so they look like '=field1*1.2') and using $(formula) again

(and variations of those taken into single brackets) 

but neither seems to work. 

Labels (2)
10 Replies
dirk_fischer
Creator II
Creator II

Hi Jordy

can you explain a little how you would address the problem now? I'm facing the same topic and would appreciate a hint in the right direction.

 

Best regards

 

Dirk