Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
QSense
Creator II
Creator II

Count

Hello

I have a cloumn let's assume B column İt has 0 and 1 values

Iwant to get ratio of 1 over total values

for instance 18 of them 1

total values 21

ratio 18/21

regards

1 Solution

Accepted Solutions
QSense
Creator II
Creator II
Author

=count(if(MT_AVAILABILITY_ACT>0,MT_AVAILABILITY_ACT))/(count (DISTINCT ID_SEGMENT_CLASS))

View solution in original post

6 Replies
hic
Former Employee
Former Employee

count(if(B=1,B)) / Count(B)

or, using Set Analysis:

Count({$<B={1}>} B) / Count(B)

HIC

its_anandrjs

Hi,

Use some thing like this to calculate

=count( if ( Column = '1', Column ) )

/

=Count(Column)

then you get the ratio 18/21

HTH

Regards,

Anand

Not applicable

Hi,

Why not use the expression?

= SUM(B) / COUNT(B)

Kind regards,

Matthijs

its_anandrjs

Hi,

But in case there is any other number other then 1 then condition fails. so i suggest use count if.

Regards

Anand

QSense
Creator II
Creator II
Author

My expression is below

if (sum(MT_AVAILABILITY_ACT)>0,'1') it means it is the name of column

When I try it it gives 0

QSense
Creator II
Creator II
Author

=count(if(MT_AVAILABILITY_ACT>0,MT_AVAILABILITY_ACT))/(count (DISTINCT ID_SEGMENT_CLASS))