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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DJ55
Contributor III
Contributor III

If expression using Variable

Hi Everyone

I am trying to create a master dimension. I am using If statement which Includes  Variables. so below statement means if Material subgroup is 'RawMaterial' and any Country in China_Manufacturer Variable then result should be China ,if Material subgroup is 'SemiFinished' and any Country in China_Vendor Variable then result should be China,if Material subgroup is Finished and any Country in India_Vendor then result should be India else ROW.

Below is the statement

=IF(MaterialSubGrouping='RawMaterial' AND {'$(China_Manufacturer)'},'CHINA',
IF(MaterialSubGrouping='SemiFinished' AND {'$(China_Vendor)'},'CHINA',
IF(MaterialSubGrouping='Finished' AND {'$(India_Vendor)'},'INDIA','ROW')))

China_Manufacturer, China_Vendor,India_Vendor these are Variables

China_Manufacturer ='KR' OR 'ID' OR 'TH' OR 'CN' OR 'HK' OR 'JP' OR 'SG' OR 'TW'

China_Vendor='KR' OR 'ID' OR 'TH' OR 'CN' OR 'HK' OR 'JP' OR 'SG' OR 'TW'

India_Vendor='IN' OR 'ZA'

but  below error is popping up

Error in expression

Error in expression:')' Exprected

If anyone can resolve this it will be of great help.

Thank you.

2 Replies
edwin
Master II
Master II

your syntax is off, this

 {'$(China_Manufacturer)'},

is normally used in set analysis and not inside an if expression.  look at the wildmatch function, that may be what you need:

wildmatch - script and chart function ‒ Qlik Sense on Windows

DJ55
Contributor III
Contributor III
Author

Hi Edwin,

Should I remove all variables from Expression?could you please help me with the expression?

Thank you.