18 Replies Latest reply: Jan 23, 2018 11:44 AM by Elizabeth Viso

# How to do a count of a word in a table - Qlik Sense

Hello,

I have a table that has a few columns that have pass or fail, at the end, I want to have a final Pass/Fail Test column showing that if all the columns contain "pass" the full test Passes if not it fails.

I tried to count the pass or fails and that does not seem to work.  I also tried:

=count({<Your Dimension={'Pass','Fail'}>} Your Dimension) which didn't work either. To get the pass or fail for the "30%" column I have the function: =If([Actual Load Percentage] > 30, 'Pass', 'Fail') and for the "35 mins" pass or fail I have the following function: =If([Total Duration of Test] > 35, 'Pass', 'Fail')

Thank you!

• ###### Re: How to do a count of a word in a table - Qlik Sense

Is this something you want to do in the script or front end?

• ###### Re: How to do a count of a word in a table - Qlik Sense

Hey Sunny!

In the front end is fine.

• ###### Re: How to do a count of a word in a table - Qlik Sense

May be this

Sum(If([30%] = 'Pass' and [35 mins] = 'Pass', 1, 0))

• ###### Re: How to do a count of a word in a table - Qlik Sense

Hi,

Why don't you just do a if(column(3) = 'Pass' AND column(7) = 'Pass','Pass','Fail')?

• ###### Re: How to do a count of a word in a table - Qlik Sense

Hey Niclas,

I tried that also but that doesn't work. Or maybe I'm doing that wrong also?!

• ###### Re: How to do a count of a word in a table - Qlik Sense

Hi,

This could be related to that you are not referencing the correct columns. However you can simply add the if-conditions for each pass/fail column and put them together with AND:

if(if-expression1 AND if-expression2,'Pass','Fail')

This makes maintenance a bit more cumbersome in case target values change etc but that can be managed by variables.

• ###### Re: How to do a count of a word in a table - Qlik Sense

How are you calculating the condition for Pass and Fail ? Have you calculated a field from the backend  or applying a condition in Column 3 and Column 7 to calculate pass or fail ?

• ###### Re: How to do a count of a word in a table - Qlik Sense

So for column 3, I use column 2 to calculate the pass or fail:

=If([Actual Load Percentage] > 30, 'Pass', 'Fail')

And for column 7, I use column 6:

=If([Total Duration of Test] > 35, 'Pass', 'Fail')

• ###### Re: How to do a count of a word in a table - Qlik Sense

Okay.

This should help :

If([Actual Load Percentage] > 30 and [Total Duration of Test] > 35, 'Pass', 'Fail')

Where [Actual Load Percentage] and  [Total Duration of Test] should be the expressions of Column 3 and Column 7 respectively.

• ###### Re: How to do a count of a word in a table - Qlik Sense

Thank you!!

• ###### Re: How to do a count of a word in a table - Qlik Sense

let's try using the below expression:

=If( [Actual Load Percentage] > 30 and [Total Duration of Test] > 35, 'Pass', 'Fail')

• ###### Re: How to do a count of a word in a table - Qlik Sense

Ah! So easy!! I was making more complicated!!

Thank you, it worked!!

• ###### Re: How to do a count of a word in a table - Qlik Sense

And if I want to add another column to that?

Thank for all the help, at some point I will have this down packed!

• ###### Re: How to do a count of a word in a table - Qlik Sense

Then we may have to modify our expression accordingly.

• ###### Re: How to do a count of a word in a table - Qlik Sense

We will have to modify this way,

If([Actual Load Percentage] > 30 and [Total Duration of Test] > 35 and [Column New] > 'X', 'Pass', 'Fail')

• ###### Re: How to do a count of a word in a table - Qlik Sense

I got it thank you.

• ###### Re: How to do a count of a word in a table - Qlik Sense

Hi Elizabeth,