Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
roebrich
Contributor III
Contributor III

Percentage KPI

Hello,

I have 2 fields on my table, assignment_group and number. I want to calculate the percentage with the formula count(number) where assignment_group is null / total number.

I want it to be a KPI placed on a text object.

Thank you!

Labels (1)
1 Solution

Accepted Solutions
ecolomer
Master II
Master II

Are you sure? Count(number)?

Count(if(IsNull(assignment_group),number))/count(TOTAL number)

View solution in original post

4 Replies
Anonymous
Not applicable

count(if(isnull(assignment_group),number))/count(number)

ecolomer
Master II
Master II

Are you sure? Count(number)?

Count(if(IsNull(assignment_group),number))/count(TOTAL number)

sunny_talwar
MVP
MVP

Or create a flag in the script

LOAD number,

     assignment_group,

     If(Len(Trim(assignment_group)) = 0, 1, 0) as NullFlag

FROM ....;

and then this expression

Count({<NullFlag = {1}>} number)/Count(number)

Anonymous
Not applicable

or

count({< $-<assignment_group={"*"}  >} number)) /count(number)

--> should be faster...