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

Count as a Percentage

Hi Can someone assist with the below please?

Sample data :

TripDelivery Point Delivery Status
001Derby

OnTime

001NottinghamLate
002NottinghamOnTime
002BirminghamLate
002DerbyOnTime
003BirminghamOnTime
003DerbyLate

I need to somehow show how many Distinct Delivery Point to a Trip were on OnTime or Late..

E.g. There has been a total of 7 Departures - 4 of them were OnTime and 3 of them were Late

Derby had 2 OnTime for 2 trips and 1 Late for 1 Trip.

The Idea is so i can show this as a percentage - Count Ontime by Delivery Point / Total Distinct Trips

Hope this makes sense!!

1 Solution

Accepted Solutions
OmarBenSalem

on time : =count({<[Delivery Status]={'OnTime'}>}Trip)/count(distinct Trip)

Late : =count({<[Delivery Status]=-{'OnTime'}>}Trip)/count(distinct Trip)

No Visits : count(distinct Trip)

result:

Capture.PNG

View solution in original post

9 Replies
OmarBenSalem

U want the count by trip or delivery pioint?

Could u create a table with the output u want as u've done for the input data?

shakeeb_mohammed
Contributor III
Contributor III
Author

LocationOnTime %Late %
Derby75%25%
Birmingham60%40%
Manchester70%30%

I need to show how many delivery points are in 1 trip and its percentage by location.

OmarBenSalem

Still can't figure out how Derby is 75% OnTime ?

OmarBenSalem

wouldn't this be more "accurate"? Mayube i'm missing sthing!

Capture.PNG

shakeeb_mohammed
Contributor III
Contributor III
Author

Sorry-

LocationNo. VisitsOnTime %Late %
Nottingham250%50%
Derby367%33%
Birmingham250%50%
OmarBenSalem

on time : =count({<[Delivery Status]={'OnTime'}>}Trip)/count(distinct Trip)

Late : =count({<[Delivery Status]=-{'OnTime'}>}Trip)/count(distinct Trip)

No Visits : count(distinct Trip)

result:

Capture.PNG

shakeeb_mohammed
Contributor III
Contributor III
Author

How come my percentages are showing way out?

Capture.JPG

OmarBenSalem

what dimension and measure u're using?

It's not clear in the image

shakeeb_mohammed
Contributor III
Contributor III
Author

I had to use distinct twice as the data I'm using had more that 1 trip number.

I used

=count({<[DeliveryStatusByBookingTime]={'OnTime'}>}Distinct Trip)/count(distinct Trip)