Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
psublue98
Creator
Creator

Issue with aggregating data in charts based on count distinct total condition

Hello - I have a survey question and response database where all user (UserID) responses (ChoiceID) to various questions (QuestionID) are logged. What we want to be able to do is identify all of the users choices made to all other questions based on when they log a particular choice to a certain question, ChoiceID 1199 that corresponds to QuestionID 399.

I'm using an expression within a table that generates the correct counts by row for a scenario where we're trying to identify the symptoms logged.

if(
count(distinct total <UserID> {<ChoiceID={'1199'}>} ChoiceID)>0,
count( {<ChoiceID={$(vSymptoms)}>} ChoiceID )
)

However, that same expression doesn't work in a chart as it's returning the total count of symptoms, not the counts based on when a UserID has logged a 1199 ChoiceID. It seems to have to do with UserID, but I can't figure it out. 

I've attached the app and dataset in excel to illustrate the desired results. For example, the correct total for symptom 1 = 574, not 640.

Thank you in advance and I'll buy you a free beer at Qonnections! Smiley Happy

Labels (5)
1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

How about:

=count( {<ChoiceID={$(vSymptoms)},UserID=P({<ChoiceID={'1199'}>}UserID)>} ChoiceID)

 

View solution in original post

2 Replies
jwjackso
Specialist III
Specialist III

How about:

=count( {<ChoiceID={$(vSymptoms)},UserID=P({<ChoiceID={'1199'}>}UserID)>} ChoiceID)

 

psublue98
Creator
Creator
Author

Works beautifully, thank you!