Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to use an IF expression to look at a list of ship methods and if its on the list return 'Parcel' and if not 'Freight' when I use the expression below it always says 'Freight'. I tried doing a "Match" but I could not get the expression to work. What am I missing?
=if([Ship Method]='FEDEX-Air-International Priority''FEDEX-Air-International Priority Late Day''FEDEX-Air-Next Day Air Early AM''FEDEX-Air-Priority Field Engineer''FEDEX-Air-Priority Overnight''FEDEX-Air-Standard Overnight''FEDEX-AIRHAZ-Priority Overnight''FEDEX-AIRHAZ-Standard Overnight''FEDEX-GROUND-Standard','Package','Freight')
Unless I do not know something new in Qlik, you need to create a nested if statement to use multiple values.
Like in this post.
https://community.qlik.com/t5/New-to-Qlik-Analytics/Nested-IF-Statements/td-p/1022597
You can also use the Match expression instead, which is more efficient.
https://community.qlik.com/t5/QlikView-App-Dev/If-statements-for-multiple-values/td-p/659682
So, this should work:
if(match([Ship Method],'FEDEX-Air-International Priority','FEDEX-Air-International Priority Late Day','FEDEX-Air-Next Day Air Early AM','FEDEX-Air-Priority Field Engineer','FEDEX-Air-Priority Overnight','FEDEX-Air-Standard Overnight','FEDEX-AIRHAZ-Priority Overnight','FEDEX-AIRHAZ-Standard Overnight','FEDEX-GROUND-Standard'),'Freight','Parcel')
@baderbd
Returning to using Match as mentioned. See it like this:
With the Match function, you will be able to list multiple values that exist in the field in question, but they need to be separated by , and quotation marks ‘’ (‘as it is a textual value’). The syntax should look like this
if(Match([Ship Method],'FEDEX-Air-International Priority',
'FEDEX-Air-International Priority Late Day',
'FEDEX-Air-Next Day Air Early AM',
'FEDEX-Air-Priority Field Engineer',
'FEDEX-Air-Priority Overnight',
'FEDEX-Air-Standard Overnight',
'FEDEX-AIRHAZ-Priority Overnight',
'FEDEX-AIRHAZ-Standard Overnight',
'FEDEX-GROUND-Standard'),'Package','Freight')
https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFunc....
- Regards , Matheus