Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
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
Partner - Master

Try this.

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

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

Try this.

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

Kuravisma
Contributor
Contributor
Author

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

BrunPierre
Partner - Master
Partner - Master

<discountCode= {"*GAUF*"}>

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

And kindly mark reply as correct answer.