Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kevbrown
Creator II
Creator II

Wildcard in Expression

Hi,

I'm looking to create a bar chart based on an expression that will need a wildcard search. So I have a column called UPC, in which there are codes, like RM1234, AB1234, TF1234 etc.  I need to pull out where the code = only RM. there is a further criteria to the expression in that I need to pull out only where there the Status field = 'Low', So i have the expression, Count(IF(UPC='RM*' and Status ='Low', '1')) but it's not working. The expression is ok but no data is pulling through.

Kev

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Kevi,

You can try either below expression

Count(IF(Wildmatch(UPC, 'RM*') and Status ='Low', '1'))


Or

Count(IF(UPC like 'RM*' and Status ='Low', '1'))

View solution in original post

8 Replies
Anonymous
Not applicable

did you try with set Analysis?

count({<UPC={'RP*'},Status={'Low'}>}yourfield)

tamilarasu
Champion
Champion

Hi Kevi,

You can try either below expression

Count(IF(Wildmatch(UPC, 'RM*') and Status ='Low', '1'))


Or

Count(IF(UPC like 'RM*' and Status ='Low', '1'))

Not applicable

This is a good solution that should solve the problem. If this selection of RM and Low is something you would use in multiple places would I create flags for it in the script instead; either to use in the set analysis or to count on ex

IF(UPC='RM*' and Status ='Low', 1,0) as _RMLow_Flag


and then in the front end just do a count(_RMLow_Flag). This also gives you an option to get a percentage of how many of your instances that are just RM Low which can come handy.


Good luck!

Not applicable

Try

count({$<Status={"Low"},UPC={"RM*"}>}UPC)

pho3nix90
Creator II
Creator II

You could use the following:

Count(IF(WildMatch(UPC,"RM*") and Status ='Low', 1))

or use set analysis

Count({<UPC={"RP*"},Status={'Low'}>} 1)

See here when to use double quotes or single quotes

https://community.qlik.com/blogs/qlikviewdesignblog/2013/04/09/quoteology#comment-17692

Kushal_Chawda

=Count({<UPC={"RM*"},Status={"Low"}>}1)

or

Count(if(wildmatch(UPC,'RM*') and Status='Low',1)

or

Count(if (UPC like 'RM*' and Status='Low',1)

I would suggest to use set analysis expression

kevbrown
Creator II
Creator II
Author

Superb, thanks

Kushal_Chawda

Hi kevin,

It is better to use set analysis instead if conditions