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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Percentage

I have one field. Let's name it 'Field_X'.
Field values are either 0 or 1.

I have to make the following calculation:

- for a secain selection i need a sum of all rows that contan Field_X = 1, divided by all rows (Field_X = 0 or 1).
Then I need to multiply it by 100 to get the percent.

How can I do it? With IF statement? CASE statement?

3 Replies
Not applicable
Author

Maybe:

= (

  SUM(Field_x)
/

COUNT(Field_x)

) * 100

Problem is I always get for SUM(Field_x) value 1...

tresesco
MVP
MVP

Sum({<Field_X={1}>} Field_X) /Sum(Field_X) *100

Update: You might want to  replace latter Sum() with Count()

senpradip007
Specialist III
Specialist III

I have tried with your expression and its working fine.