Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
darrellbutler
Creator
Creator

Calculate a Ratio

Folks,

I'm trying to work out a service level which is a straightforward calulation of Desired / Delivered. I have a dimension of customer_No.

I now need to exclude some customers who are no longer serviced and I introduced the follwing:

=

sum({<[CUSTOMER_NO] -= {80148}>}((DELIVERED)/(DESIRED)))

Whilst this works fine and excludes the calculation for the customer in question, all other customers %service level is wrong.i.e 4000%

Any thoughts how I can get round this, using aagr on the customer no dimension does not appear to work either.

Many thanks





4 Replies
rbecher
MVP
MVP

Hi,

maybe this is better:

sum({$<[CUSTOMER_NO] -= {80148}>} DELIVERED) / sum({$<[CUSTOMER_NO] -= {80148}>} DESIRED)


- Ralf

Astrato.io Head of R&D
darrellbutler
Creator
Creator
Author

Thanks for the reply Ralf, when I do this all service levels default to 100% - wopuld be nice but infortunately not accurate !

Any further ideas, many thanks

rbecher
MVP
MVP

I mean, 100% is much more realistic than 400% 😉

Can you post an example app?

- Ralf

Astrato.io Head of R&D
darrellbutler
Creator
Creator
Author

Very Good Ralf - I'll try that one next time I'm speaking with our accountants !Big Smile

I've got round this now by splitting my set analysis into two separate expressions then just dividing one into the other using the the column() command. Does the trick.

Thanks for your time

Rgds

Darrell.