Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
beunderf
Partner - Creator II
Partner - Creator II

Dynamically sum latest values per case

Dear all,

I have the following question. How do I create an expression that dynamically sums the latest values per case, depending on my selection. I have the following example:

RownrCasenumberMonthMonthStepValueMonthnrKPI
11Jan151KPI
21Jan261KPI
32Jan141KPI
41Feb172KPI
53Mar153KPI
63Mar243KPI
71Mar153KPI

As you can see, within a month a case can have more values. The highest 'month step' is the last value entered in a month.

Now I want to SUM(Values), but only the last Value per case, depending on my selection.

So if I select 'Jan', I want to sum 6 for Case_1 and 4 for Case_2, totals 10

If I select 'Jan, Feb', then the latest value for Case_1=7 and Case_2 =4, total 11

If I select 'Jan, Feb, Mar', then the latest value for Case_1 =5, Case_2= 4 and Case_3=4, total 13

How do I achieve this? I attached my example to question.

Thanks!

1 Solution

Accepted Solutions
maxgro
MVP
MVP

try with

dim     Casenumber

exp     FirstSortedValue(Value, -Rownr)

View solution in original post

4 Replies
Not applicable

Look at the attacchment.

Hope this helps.

MC

beunderf
Partner - Creator II
Partner - Creator II
Author

Hi Mario,

This is not what I am looking for. with MAX I get the Highest value per case, but this is not what I want. If you look at Case_1, it has a lower Value in March (5), but the Value in March is the 'latest' value. When I select 'Jan, Feb, Mar' I want to see the latest values entered, not the highest values, if you understand what I mean.

maxgro
MVP
MVP

try with

dim     Casenumber

exp     FirstSortedValue(Value, -Rownr)

Not applicable

Attached with the answer you are looking for.

Hope it helps

Thanks

AJ