Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Expression help

Hi,

I have the following expression and I can't seem to get it to work:

=If(strategy_ref = 'Physical' and Count(trade_type_group_cd ='Future',trade_num)>0 and compliance_checked_flg ='N','Y','N') 

It would be much appreciated if someone could point out where I am going wrong.

Regards,

Daniel

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Yes, I can help you here

=If((strategy_ref = 'Physical' and Count({<trade_type_group_cd ={'Future'}>} trade_num)>0 and compliance_checked_flg ='N') or (strategy_ref = 'Hedge' and Count({<trade_type_group_cd ={'Physical'}>} trade_num)=0 and compliance_checked_flg ='N') or (strategy_ref = 'Trading' and Count({<trade_type_group_cd ='Physical'}>} trade_num)>0 and compliance_checked_flg ='N')

,'Y','N')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

6 Replies
Anil_Babu_Samineni

Try this

=If(strategy_ref = 'Physical' and Count({<trade_type_group_cd ={'Future'}>} trade_num)>0 and compliance_checked_flg ='N','Y','N')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ali_hijazi
Partner - Master II
Partner - Master II

it seems you don't know the set analysis syntax

but where are you writing this in script or on chart

if on chart then you need to write your expression as follows:

if(strategy_ref = 'Physical' and count({<trade_type_group_cd={'Future'>}trade_num) >0 and compliance_checked_flg='N' ,'Y','N')

I can walk on water when it freezes
danielnevitt
Creator
Creator
Author

Hi Anil/Ali,

Thank you both for your help.  That now works perfectly.

Are you able to help with adding the below:

=If(strategy_ref = 'Physical' and Count({<trade_type_group_cd ={'Future'}>} trade_num)>0 and compliance_checked_flg ='N','Y','N') or
If(strategy_ref = 'Hedge' and Count({<trade_type_group_cd ={'Physical'}>} trade_num)=0 and compliance_checked_flg ='N','Y','N') or
If(strategy_ref = 'Trading' and Count({<trade_type_group_cd ={'Physical'}>} trade_num)>0 and compliance_checked_flg ='N','Y','N')

Regards,

Daniel

Anil_Babu_Samineni

Yes, I can help you here

=If((strategy_ref = 'Physical' and Count({<trade_type_group_cd ={'Future'}>} trade_num)>0 and compliance_checked_flg ='N') or (strategy_ref = 'Hedge' and Count({<trade_type_group_cd ={'Physical'}>} trade_num)=0 and compliance_checked_flg ='N') or (strategy_ref = 'Trading' and Count({<trade_type_group_cd ='Physical'}>} trade_num)>0 and compliance_checked_flg ='N')

,'Y','N')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
danielnevitt
Creator
Creator
Author

Hi Anil,

Thank you for your help, that all worked perfectly.

As a last favour, would it be possible to explain how to use the code in the LOAD statement?

Regards,

Daniel

Anil_Babu_Samineni

Why not calling as field name?

If((strategy_ref = 'Physical' and Count({<trade_type_group_cd ={'Future'}>} trade_num)>0 and compliance_checked_flg ='N') or (strategy_ref = 'Hedge' and Count({<trade_type_group_cd ={'Physical'}>} trade_num)=0 and compliance_checked_flg ='N') or (strategy_ref = 'Trading' and Count({<trade_type_group_cd ='Physical'}>} trade_num)>0 and compliance_checked_flg ='N')

,'Y','N') as FieldName


Note - Please close this thread, If you found what you looking

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful