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: 
Not applicable

Conditional Expression Statement

I could use some help and guidance here.  I have a set of reports that I need a column to count a piece of data only if it meets a specifc condition.  The field I need to count can contain several options, all text, but I would like to count only those matching one of them in a separate column.

I have tried an IF statement like this:  =if([Price Source] = 'OV',textcount([Price Source]),0)

I have also tried to use an <> does not equal statement.  The Price Source field and the Price Source Original fields can be the same unless someone overrode the suggested price, hence the 'OV' in the field I would like to count.

Right now it is set up as a expression in the table properties, but I am open to suggestions on how to make this work.


Thanks

Brian

1 Solution

Accepted Solutions
Nicole-Smith

=count({<[Price Source]={'OV'}>}[Price Source])

View solution in original post

6 Replies
Nicole-Smith

=count({<[Price Source]={'OV'}>}[Price Source])

Anonymous
Not applicable
Author

The correct logic with "if":

=count(if([Price Source]='OV',  [Price Source])

Nicole-Smith

Please mark the answer as correct if it worked for you.  It makes it easier for people looking for similar problems to find an answer.

Not applicable
Author

Thanks Nicole, it was very helpful and worked like a charm.  I do have one more challenge for you though.  Obviously I am looking at pricing and sales data, and in both of the columns mentioned I have multiple options returned in the data base. 

How can I modify the statement that you provided so that I continue to count the 'OV' items in the Price source column, but exclude any in the Price Source Original column that equal a specific value, Like 'P0'?

Thanks again for the help and direction.

Brian

Nicole-Smith

=count({<[Price Source]={'OV'}, [Price Source Original] /= {'P0', 'P1'}>}[Price Source])

This will ignore anything in the Price Source Original column that has values 'P0' or 'P1' (you can add more to the list as desired).

I'm glad it was helpful!

Not applicable
Author

Thanks, I will give it a try.