# 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
Not applicable

Check this ...

Highlighted
Master III

LIke this

Highlighted
Master II

## Re: sum problem

see the attached file

Highlighted
Creator III

## Re: sum problem

i cant open the files =(

can someone explain in word the solution?

Highlighted
Creator III

not working )=

Highlighted
Specialist II

## Re: Re: sum problem

Hello, I used the formula:

sum(aggr(firstsortedvalue(distinct hours, -hours), cust, date))

This will get the highest hours for a date (if they happen to be different for instance if you had A 1.1.14 to have 9 and 11 for hours), then sum all the hours for the different dates for a customer. I believe this is what you are looking for. Then work hours is:

sum(work_hours)

Highlighted
Master III

## Re: sum problem

Script:

-------------------------------------------------------------

Tab1:

Load * Inline [

cust,date,avail_hours,work

A,1.1.14,9,2

B,2.1.14,9,3

C,3.1.14,9,4

A,1.1.14,9,5

C,2.1.14,9,6 ];

Final:

Load *,If(RowNo() <> 1 And cust = Previous(cust) And date = Previous(date),1,0) As Ind Resident Tab1 order by cust,date;

Drop table Tab1;

-------------------------------------------------------------

Use these expressions in front end

sum(If(Ind=0,avail_hours))

sum(work)