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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

convert an 'if 'statement to set analysis,need help please????

Hi all,

I am little week in set analysis, so please can someone help me out in getting the below expression in set analysis method????????

if [buy/sell] ='BUY' then [option]-[premium] as a new field.

here the option column is a calculated expression in the table which has many variables and used in a macro as well in it.so is there a method to represent it with a field or else I will have to put the whole formula into the new expression.

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You cannot use set analysis in the script, only in chart expressions. If you want to use the expression in a chart you can use something like sum({<[buy/sell]={'BUY'}>} [option]-[premium]). Note that option and premium have to be fields and cannot be labeled expressions.

If it's possible to use an if statement in the script to calculate a new field then that's the best solution.


talk is cheap, supply exceeds demand
Not applicable
Author

Where exactly you want use this expr? As a calc Dimension or in Expressions?

You can just use if if ([buy/sell] ='BUY' ,[option]-[premium])

Regards,

Prabhu