Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

What is the expression to solve this?

I am using Qlik Sense Desktop.

Below is the table and data I am using to illustrate.

Each person with Unique ID have 2 choices.

Only 1 choice will be offered. And each person has to indicate whether to accept the choice allocated to him/her.

What is the expression to count the number of person who have accepted 'Butter, as their choice? (ie Acceptance = 'Yes' and ((1st Choice = 'Butter' and ChoiceOffered = '1st') or (2ndChoice = 'Butter' and ChoiceOffered = '2nd'))

Thanks.

   

Unique ID1stChoice2ndChoiceChoiceOfferedAcceptance
1BreadButter2ndNo
2ButterApple1stYes
3OrangeBread1stYes
4AppleOrange2ndYes
5BreadButter2ndNo
6ButterApple1stYes
7OrangeBread1stYes
8AppleOrange2ndYes
9BreadButter2ndNo
10ButterApple1stYes
11OrangeBread1stYes
12AppleOrange2ndYes
13BreadButter2ndNo
14ButterApple1stYes
15OrangeBread1stYes
16AppleOrange2ndYes
17BreadButter2ndNo
18ButterApple1stYes
19OrangeBread1stYes
20AppleOrange2ndYes
14 Replies
sunny_talwar

Which field are you making the choice in? 1stChoice or 2ndChoice or there is another field where you make this selection?

Anonymous
Not applicable
Author

I select 1st Choice chart but wanted to show KPI for both 1st Choice and 2nd Choice. What should be the expression?

I tried this below but I wanted to show KPI for say butter (be it butter being 1st or 2nd choice)

Count({<ChoiceOffered={'1st'},[Acceptance]= {'Yes'}>}Distinct [NRIC])+

Count({<ChoiceOffered={'2nd'},[Acceptance]= {'Yes'}>}Distinct [NRIC])

sunny_talwar

May be this

=Count({<ChoiceOffered = {'1st'}, Acceptance = {'Yes'}>+

<[2ndChoice] = p([1stChoice]), ChoiceOffered = {'2nd'}, Acceptance = {'Yes'}, [1stChoice]>} DISTINCT [Unique ID])

Capture.PNG

Anonymous
Not applicable
Author

Thanks, Sunny. Will need to also count those 2nd choice butter who accepted.

sunny_talwar

The expression is already doing that