Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a column called 'DEP_TIME' in my data set. It is measured in minutes.
If the DEP_TIME is on time, it is equal to 0.
Else, the DEP_TIME is late and has a value greater than 0.
I am looking to calculate the proportion of records on time (with '0') expressed as a percentage of all records.
So, something like this:
(Count of 'late' = '0') / ((Count of 'late' = '0') + (Count of 'late' > '0')) * 100
I am not familiar with Qlik custom functions, so I could please use some help!
Try this
COUNT({<DEP_TIME= {'0'}> } DEP_TIME) /
(COUNT({<DEP_TIME= {'0'}> } DEP_TIME) + COUNT({<DEP_TIME= {">0"}> } DEP_TIME) ) * 100
Hey,
I tried using a similar function and the results for
COUNT({<DEP_TIME= {'0'}> } DEP_TIME) alsways returns as '0'. Which is not the case, most of the values in the column are actually '0'.
The format of '0' in the column is '0.00', not sure if that needs to changed?
Then perhaps try the below or would you share the 'DEP_TIME' values
COUNT({<DEP_TIME= {'0.00'}> } DEP_TIME)
@rossdickinson Is your question answered?
You need to count on a field that identifies each row uniquely
example
=count( {<DEP_TIME={"0"}>}rowid) / count( {<DEP_TIME={">=0"}>}rowid)
or just
=count( {<DEP_TIME={"0"}>}rowid) / count(rowid)