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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate KPI

hi guys,

     I have a little problem with KPI calculation.

I've this situation:

Dateemployeesrevenue

01/01/2017

5

120000
01/02/20175125400
01/03/20175150000
01/04/20175140000
01/05/20175132500

I have to calculate revenue / employees like :

                    sum(revenue) / employees

that is:

                    667900 / 5

But on qlikview if I write:

               = sum(revenue) / employees


I get back " - " symbol


so I try:

          = sum(revenue) / sum(employees)


this works but the result is incorrect because the values are:

                    667900 / 25

How can I do?


This is an example and the original table have more values than this.


Thanks

Labels (1)
13 Replies
Anonymous
Not applicable
Author

every moth the system receves a file like this

iddateemployeesrevenuen.calletc....

and there are many lines.

The number of employees is a constants, but I have very different values, because I have many different id.

I need to calculate sum(revenue) / employees

where the number of employees isn't a sum(employees), but only a single value.

Do you understand now my problem?

Anil_Babu_Samineni
MVP
MVP

Still not sure, Even thought what you tried is

sum(revenue) / 5


So, If you need to constant even selection happened

sum(revenue) / Count({1}employees)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi, Try it, please

sum(revenue) / sum(Distinct employees)


Regards.


MarcoWedel
MVP
MVP

Hi,

your expression doesn't show this behaviour with your sample data:

QlikCommunity_Thread_284369_Pic1.JPG

Instead I guess that you have changing employee numbers in your real data that causes the implicit only() aggregation of your expression to return null.

See also:

The Only Function

It’s all Aggregations

Use Aggregation Functions!

One solution to calculate this cumulated revenue per employee might be simply:

=Sum(revenue / employees)

QlikCommunity_Thread_284369_Pic2.JPG

QlikCommunity_Thread_284369_Pic3.JPG

hope this helps

regards

Marco