Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to count records that belong to numeric ?

Hi,

I have the following data in my Qlikview data model.  I need to find the attendance of the student belonging to CME.

I can get the numerator (I use set analysis and filter by QuestionType (CME) and QuestionData (1)) but not the denominator.

Denominator: I need to count the total number of rows that belong to each student under QuestionType (CME).

Example.  I should get 3 counts for student A belonging to CME.  Any one can help on this?


Thanks!

Chun Wey

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There should be no difference between sum() and count() if if the data is "1". I just find count() easier in this case to avoid the if().

To also filter on the QuestionType, add a Set expression.

Sum({<QuestionType={CME}>}-IsNum(QuestionData))


-Rob

View solution in original post

6 Replies
Not applicable
Author

count(if(Upper(qdata)=Lower(qdata),1))

Try that.

Not applicable
Author

PFA.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about

Sum(-IsNum(QuestionData))

-Rob

Not applicable
Author

Hi Rob, Ramkumar,

Thanks for your responses.

I mange to do this as I need to further filter by questiontype.  Have to do a count instead of sum as I am counting the no of records belonging to numeric values.  Only concern here is the performance as I am using IF statement .

COUNT(IF(QuestionType='CME' AND IsNum(QuestionData)=-1,1))

Thanks for your help.  However, if you have better suggestion on the above expression, will be more happy to know.

Rdgs,

Chun Wey

Not applicable
Author

Thank you

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There should be no difference between sum() and count() if if the data is "1". I just find count() easier in this case to avoid the if().

To also filter on the QuestionType, add a Set expression.

Sum({<QuestionType={CME}>}-IsNum(QuestionData))


-Rob