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

SUM of MAX day by day

Hi,

i have a problem.

i have many counters with growing values:

COUNTER 1 , DAY 1 = 1

                                    2

                                   4

                                   7

counter 1 day 2 =  9

                              11

                                   18

                              ecc...

COUNTER 2 , DAY 1 = 3

                                    5

                                   6

                                   9

counter 2 day 2 =  12

                              13

                                   15

                              ecc...

i need a table that day by day make the sum of max value for each counter like:

day 1 : 16 (max of counter 1 & counter 2 in the first day =7+9)

day 2 : 33 (max of counter 1 & counter 2 in the second day = 18+15)

i can make a table day by day but sum of max doesn't work...

Thanks

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You need to use advanced aggregation:

=sum( aggr( max(CounterField), CounterField, DayField) )

Hope this helps,

Stefan

View solution in original post

4 Replies
swuehl
MVP
MVP

You need to use advanced aggregation:

=sum( aggr( max(CounterField), CounterField, DayField) )

Hope this helps,

Stefan

Anonymous
Not applicable
Author

Thanks a lot Stefan,

works great.

Can i ask you another question?

can i exclude some counter field ?

if i don't want the counter 1 and make the "sum of max" of counter 2,3,4....

can i use something like if(CounterField <>1, ......

i have try this "if" but doesn't work.

swuehl
MVP
MVP

Yes, you can do this, try this:

=sum( aggr( max( if( CounterField<>1, CounterField)), CounterField, DayField) )

Anonymous
Not applicable
Author

Thanks a lot, again !

Now works...

i had put the IF expression in the wrong field...