Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Neptune
Contributor
Contributor

Expression to count if a partial string exist in a field

Hello All,

I imported an excel file into Qlik.

I have a column of data where I need to count if any the text contain the word 'blue'.

I wrote the expression:

If (MyColumn LIKE '*Blue*', count(MyColumn),)

The Gauge chart showing this results with no data. Any ideas why its not able to identify the rows using a partial string search?

Thanks

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

That formula is wrong on three levels:

* There's no "LIKE" statement in Qlik

* The if() should go inside the count(), not vice versa

* The syntax is incorrect because of the extra comma at the end

You could use:

Count(If(Wildmatch(MyColumn,'*Blue*'),MyColumn))

But a better approach would likely be to use Set Analysis:

Count({< MyColumn = {"*Blue*"} >} MyColumn)

 

 

View solution in original post

2 Replies
Or
MVP
MVP

That formula is wrong on three levels:

* There's no "LIKE" statement in Qlik

* The if() should go inside the count(), not vice versa

* The syntax is incorrect because of the extra comma at the end

You could use:

Count(If(Wildmatch(MyColumn,'*Blue*'),MyColumn))

But a better approach would likely be to use Set Analysis:

Count({< MyColumn = {"*Blue*"} >} MyColumn)

 

 

Neptune
Contributor
Contributor
Author

Thank you. Your tips solved my issue!