# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for
Did you mean:
Highlighted
Creator II

## Some help with the use of aggr(

I need to sum the amount of worked hours/day,in an expression, however if the amount of worked hours is above 8 hours, then the value is equal with 8.

the column headers are: Employee_ID, Date, Hours_Worked.

How should I use the aggr function inside a sum to get the results I need?

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Employee

## Re: Some help with the use of aggr(

Then you need Aggr() to create an intermediate iterator. Try

Sum(Aggr(RangeMin(8,Sum(Hours_Worked)),Date,Employee_ID))

HIC

5 Replies
Highlighted
MVP & Luminary

## Re: Some help with the use of aggr(

Try something like this: RangeMin(8, sum(Hours_Worked)).

Or perhaps sum(aggr(RangeMin(8, sum(Hours_Worked)), Employee_ID, Date))

talk is cheap, supply exceeds demand
Highlighted
Employee

## Re: Some help with the use of aggr(

If you want to show number of hours per day and employee, you should use Date and Employee_ID as dimensions, and

If(Sum(Hours_Worked)>8,8,Sum(Hours_Worked))

as measure.

No need for an Aggr().

HIC

Highlighted
Creator II

## Re: Some help with the use of aggr(

It seems to work for showing the number of worked hours per day per employee, but I need the sum of all the worked hours. Tried   Sum(If(Sum(Hours_Worked)>8,8,Sum(Hours_Worked))) but I get an "Error in expression" message

Highlighted
Employee

## Re: Some help with the use of aggr(

Then you need Aggr() to create an intermediate iterator. Try

Sum(Aggr(RangeMin(8,Sum(Hours_Worked)),Date,Employee_ID))

HIC

Highlighted
Creator II

## Re: Some help with the use of aggr(

That's it, thanks!