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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Kuravisma
Contributor
Contributor

Count text with specific values

Hi I just started using Qlik yesterday and hope this question is not too easy to answer. I have a list "discountCodes" which contains a large number of codes that look something like this: 123cv-GAUFsdf
Now I want to count all codes that contain the value GAUF. For this I have tried the following formulas, which all give me the value 8.622. But the correct value is 225.

textcount(if(match(discountCode,'GAUF'),discountCode,discountCode))

textcount(if(match(discountCode,'*GAUF*'),discountCode,discountCode))

Can someone help me? I am really desperate.
Later I want to create a list of all the codes contained in the data and display the number of times each particular value appears in it.

Best regards
Hendrik

Labels (1)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master II
Partner - Master II

Try this.

Count({$<discountCode={"*GAUF*"}>} discountCode)

View solution in original post

3 Replies
BrunPierre
Partner - Master II
Partner - Master II

Try this.

Count({$<discountCode={"*GAUF*"}>} discountCode)

Kuravisma
Contributor
Contributor
Author

Amazing. I have no idea why this works but it works 😉

BrunPierre
Partner - Master II
Partner - Master II

<discountCode= {"*GAUF*"}>

This simply says, select all discountCode that contain the string ’GAUF’ regardless of its position.

And kindly mark reply as correct answer.