Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum a number or flaged items from one point

Hi guys,

I have a problem and limited time to solve it. Maybe you can help.

I have data with this configuration:

DateVALUEFLAG
01/01/2014201
02/01/2014181
03/01/201471
04/01/2014461
05/01/201450
06/01/201461
07/01/2014171
08/01/201480
09/01/2014151
10/01/2014441
11/01/2014380
12/01/2014171
13/01/2014191
14/01/2014200
15/01/2014481
16/01/2014100
17/01/2014161
18/01/2014501
19/01/2014220
20/01/2014451
21/01/2014411

What I want to do is count backwards from the 15/01/2014 date, only the first 5 flagged values. Something like:

=Sum({$<Date= {"<=15/01/2014"},FLAG = {"1"}>} VALUE)

but I need to limit the flag to the first 5 occurrences. Is that possible?

Thank you so much for your help.

Kind regards,

Nuno

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe something like

=Sum({$<Date= {"=rank(only( {<Date= {"<=15/01/2014"},FLAG = {"1"}>} Date)<=5"} >} VALUE)

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe something like

=Sum({$<Date= {"=rank(only( {<Date= {"<=15/01/2014"},FLAG = {"1"}>} Date)<=5"} >} VALUE)

Not applicable
Author

Thank you swuehl.

After changing double quotes to single and adding an extra parenthesis, it worked perfectly.

You are truly a legend...