Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikuser22
Creator II
Creator II

Match or wildmatch

Hi I am trying to create a button and KPI's using ID's.

I have ID's starting with ABxxxxx, ABCxxxxx, INxxxx, INNxxxx

I want to display IN* and AB* but I should not include IDs starting with ABC*. 

I am trying to do something like, 

=if( wildmatch( ID,'AB*','IN*'),ID) -- But this includes ABC* also, how to avoid that ? 

 

Thanks in advance

 

 

Labels (1)
2 Solutions

Accepted Solutions
hic
Former Employee
Former Employee

if( wildmatch( ID,'AB*','IN*') and not wildmatch( ID,'ABC*'),ID)

View solution in original post

hic
Former Employee
Former Employee

I think it could be useful to put this logic in the script: Create a flag that indicates whether the ID should be included or not:

if( wildmatch( ID,'AB*','IN*','SD*') and not wildmatch( ID,'ABC*'),1,0) as IncludeID,

Then you can manage the logic there, and you don't need to edit the expressions of several charts. Just use

Sum({<IncludeID={1}>} [Total Billing])

View solution in original post

4 Replies
hic
Former Employee
Former Employee

if( wildmatch( ID,'AB*','IN*') and not wildmatch( ID,'ABC*'),ID)

qlikuser22
Creator II
Creator II
Author

OMG! Is it that simple. Thanks a lot. 🙂 It worked

qlikuser22
Creator II
Creator II
Author

@hic  

Hi

Your solution worked out. Thanks for it. But I have an issue like, I have many ID's starting with DN*, AB* ,ABC* ,IN*, SD*.

I am using the same concept in sum expression in a bar chart and KPIs like,

Sum({< ID={"AB*","IN*","SD*"}, ID -={"ABC*"}, [Total Billing] -={0}>}[Total Billing])  -- This includes the billing of other ID's also.

I want to show the sum for only ID's starting with AB*, IN*, SD* .

Any help. 

 

Thanks. 

 

then it also includes SD*,

hic
Former Employee
Former Employee

I think it could be useful to put this logic in the script: Create a flag that indicates whether the ID should be included or not:

if( wildmatch( ID,'AB*','IN*','SD*') and not wildmatch( ID,'ABC*'),1,0) as IncludeID,

Then you can manage the logic there, and you don't need to edit the expressions of several charts. Just use

Sum({<IncludeID={1}>} [Total Billing])