Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
malradi88
Creator II
Creator II

Using OR/IF function in Set Expression

Dear Qlik Community,

I hope this finds you well. I am currently working on a data set that consists of 3 fields (Trainee ID, Economic Literacy Score, Value Chains Test Score).

I have the following set expression:

Count({$<[Value Chains Test Score]={'>=7'},  [Economic Literacy Score]={'>=7'}>}[Trainee ID])

This expression gives me the # Trainees that took both Value Chains & Economic Literacy trainings and scored >7 in both. It is worth nothing that all trainees take both trainings.

I would like to amend it to say: Count the number of Trainees (distinct without repetition) that scored at least 7 in either the 'Value Chains training' or Economic Literacy training'. I can't seem to get the syntax right for it though. Or perhaps this is best answered using addition and a distinct function that covers both parts of the addition expression?

If anything comes to mind I would be most appreciative.

Best,

Mohammed

1 Solution

Accepted Solutions
sunny_talwar

May be this

Count({$<[Value Chains Test Score]={'>=7'}>+<[Economic Literacy Score]={'>=7'}>}[Trainee ID])

View solution in original post

4 Replies
sunny_talwar

May be this

Count({$<[Value Chains Test Score]={'>=7'}>+<[Economic Literacy Score]={'>=7'}>}[Trainee ID])

malradi88
Creator II
Creator II
Author

Thank you Sunny!

malradi88
Creator II
Creator II
Author

Hi Sunny,

If there is a third training I want to insert into the set expression but all values for that training are currently null what can I do? I tried continuing with the pattern of >+<[Training3] but it then counted every null value. Thank you for your help.

Best,

Mohammed

sunny_talwar

Can you show by an example as to what exactly you are trying to do?