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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Max(Date) vs. Set analysis?

Hi,

I have the following problem and I have you know the answer:

In a fact table I have, for example, a few records.

CustomerNrPolisNrBookDateAmount
1234abc-11-1-20151000
1234abc-1

9-1-2015

950

1234abc-16-6-2015750
1234def-11-9-2015500
5678dfg-16-3-2015700
5678dfg-1

15-9-2015

1250
5678dfg-1

16-9-2015

850
5678dfg-11-11-2015350

Bases on Time selections I want the correct Amount per CustomerNr and PolisNr.

For example:

When I selecting year 2015 i want to see an Amount of 750 + 500 + 350 = 1600

When I selecting year 2015 and Quarter 1, I want to see 950

When I selecting year 2015 and month 9, I want to see 500 + 850

When I selecting year 2015 and week 38, I want to see 850

When I selecting year 2015 and day 1-9-2015, I want to see 500

I hope you can give me an answer!

Best regards,

Arjan

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=Sum( Aggr( FirstSortedValue(Amount, -BookDate), CustomerNr, PolisNr))

View solution in original post

3 Replies
swuehl
MVP
MVP

Try

=Sum( Aggr( FirstSortedValue(Amount, -BookDate), CustomerNr, PolisNr))

martijn
Contributor III
Contributor III

That what Swuehl says

Anonymous
Not applicable
Author

Thanks Swuehl!