Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
marcel_olmo
Partner Ambassador
Partner Ambassador

Question aggregate

Hi guys, if I have a table like this :

DateNumber
20/01/20122
20/02/20122
20/03/20121
20/04/20123
20/05/20121
20/06/20121

How could I get a table like this with set analysis ?

DateNumber
20/01/20120
20/02/20120
20/03/20120
20/04/20120
20/05/20120
20/06/201210

Regards, Marcel.

15 Replies
salto
Specialist II
Specialist II

Hi Marcel,

PFA my solution... hope this helps!

Regards.

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Salto! That do the work, but I'd love to do it with set analysis because this is a dummy test, but in my case I'm talking about millions of rows, and in the last row of "number", you have to put the sum of all the related values above.

I think it should be withh aggr, because there's no only a "date" field to consider, it has to consider 5 fields more.

Regards, Marcel.

Not applicable

Hi Guys,

Just a little change to get total on June not on April

best regards

Chris

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

This is my real case :

DateIDTotal ValueNumber
11/03/2009R04106040,251
24/08/2009R04106074,071
05/08/2010R041060289,021
20/08/2010R04106089,931

And my desired result would be :

DateIDTotal NewNumber New
11/03/2009R04106000
24/08/2009R04106000
05/08/2010R04106000
20/08/2010R041060493,274
salto
Specialist II
Specialist II

Hi,

I have tried with

=aggr(sum(TotalValue),ID)

and

=aggr(count(total Number),ID)

but the result is not exactly what we are looking for... sorry about that,

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Salto for the try! I know this is not that easy.

My proper example of what I'm looking for would be :

This is my current table :

DateIDTotal ValueNumber
11/03/2009R04106040,251
24/08/2009R04106074,071
05/08/2010R041060289,021
20/08/2010R04106089,931
12/03/2009R04106550,251
25/08/2009R04106584,071
07/08/2010R041065389,021
22/08/2010R04106599,931

This is my desired table :

DateIDTotal ValueNumber
11/03/2009R04106000
24/08/2009R04106000
05/08/2010R04106000
20/08/2010R041060493,274
12/03/2009R04106500
25/08/2009R04106500
07/08/2010R04106500
22/08/2010R041065623,274

Anybody knows how to make it?

Regards, Marcel.

bdunphy
Contributor III
Contributor III

see attached document.

calculation as below :

If(

MaxString(ID)

<>

below(Total ID)

,

Sum(Total<ID>[Total Value]),' ')

Capture.JPG.jpg

er_mohit
Master II
Master II

Try this

variable

FromDate=    =max(DATE)

ToDate=          =min(DATE)

EXpression

aggr( RangeSum(above(sum({<DATE={">=$(ToDate) <=$(FromDate)"}>}Sales),0,RowNo())),DATE)

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks for the try Mohit!

The min and max Date has to be dinamically, because it depends on more than one field which is the maximum date per ID.

And in the total row will get the same total result as a regular sum.

Here is what I'm trying to get :

DateIDTotal ValueNumber
11/03/2009R04106000
24/08/2009R04106000
05/08/2010R04106000
20/08/2010R041060493,274
12/03/2009R04106500
25/08/2009R04106500
07/08/2010R04106500
22/08/2010R041065623,274
Total 1116,548