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

Announcements
Q&A with Qlik: Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

PLS GIVE EXPRESSION FOR THIS

(Vendor Invoice Value x 2.50)/100. This formula should be applied for the only following Storage Locations  -IB01, IB04, IF01, IF02, IF04, IL01, IL02, IN01, IN02, IN04, ING1, IP01, IP04




PLS  TELL ME   EXPRESSION   FOR  THIS  

Labels (1)
6 Replies
m_woolf
Master II
Master II

if(index(StorageLocation,'IB01, IB04, IF01, IF02, IF04, IL01, IL02, IN01, IN02, IN04, ING1, IP01, IP04')>0,

     (Vendor Invoice Value x 2.50)/100,

     Vendor Invoice Value) as Whatever;

Not applicable
Author

what is index  here

tresB
Champion III
Champion III

Using Match(), like:

=Sum(If(Match(StorageLocation,'IB01', 'IB04','IF01', 'IF02', 'IF04', 'IL01', 'IL02', 'IN01', 'IN02', 'IN04', 'ING1', 'IP01', 'IP04') , Vendor [Invoice Value x 2.50] )/100)

anbu1984
Master III
Master III

Index is string function

From QV help

index(s1 , s2[ , n])

Position of a substring. This function gives the starting position of the n:th occurrence of substring s2 in string s1. If n is omitted, the first occurrence is assumed. If n is negative, the search is made starting from the end of string s1. The result is an integer. The positions in the string are numbered from 1 and up.

Your field StorageLocation should be second argument to Index function like below

if(index('IB01, IB04, IF01, IF02, IF04, IL01, IL02, IN01, IN02, IN04, ING1, IP01, IP04',StorageLocation)>0,

     (Vendor Invoice Value x 2.50)/100,

     Vendor Invoice Value) as Whatever;

anbu1984
Master III
Master III

Index can be used like this

index('IB01, IB04, IF01, IF02, IF04, IL01, IL02, IN01, IN02, IN04, ING1, IP01, IP04',StorageLocation)

MayilVahanan
MVP
MVP

HI

Try with Match function

=Sum(If(Match(StorageLocation,'IB01', 'IB04','IF01', 'IF02', 'IF04', 'IL01', 'IL02', 'IN01', 'IN02', 'IN04', 'ING1', 'IP01', 'IP04') ,

(Vendor [Invoice Value x 2.50] )/100, 0))

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.