6 Replies Latest reply: Jun 3, 2016 3:24 AM by Corinna Theiß

# sum of Top 10 weeks

Hi,

I am looking for an expression for the below scenario..

I have employeeName, week, hours information.

now i want to calculate the sum of hours of an employee who exceeds 20 hours a week for more than 10 weeks.

To be more clear...

an employee who  spent more than 20 hours for more than 10 weeks, now i need sum of these 10 weeks hours.

kindly help me with the expression ..

Thanks,

Dileep.

• ###### Re: sum of Top 10 weeks

it goes like this...

Sum of hours where hours > 48 for more than 10 weeks.

I need top 10 sum values here..

Its urgent , kindly help me asap.

• ###### Re: sum of Top 10 weeks

Hi there,

Can you upload a sample of your data? That way we can make a solution for you.

Regards,

MB

• ###### Re: sum of Top 10 weeks

Please post a small Qlikview document that illustrates the problem.

• ###### Re: sum of Top 10 weeks

Hi Dileep,

I guess this is what you were searching for.

It is working with aggregated values in the data model.

it is using applymap() of weeks per employee to get the "where sum(hours) per week and employee is >=20"

• ###### Re: sum of Top 10 weeks

Assuming Week is Number 1,2,3

=Sum({<Hour={"=Sum({<Week={">=\$(=max(Week)-10)"}>}Hour)>20"}>}Hour)

• ###### Re: sum of Top 10 weeks

or better to use Date

Sum({<Hour={"=Sum({<Date={">=\$(=max(Date)-70)"}>}Hour)>20"}>}Hour)