Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Whats wrong with this simple AGGR()?

Can some one please help me and explain whats wrong with the AGGR statement below. I tried working around this statement changing the functions, but its no use. I have total values at month level and unable to get the running totals using the AGGR(). I just have 4 months data. Its really annoying me for sometime now.

sum(aggr(sum(vLastFctPayment.Amount)-(sum(Expenses.Expenses)-sum(vLastFctPayment.ServicingFee)),Calendar.YearMonth))

I have above expression within a variable called $(vCashToMonth) and I even tried aggr($(vCashToMonth), Calendar.YearMonth) still doesnt work.

Thanks a ton in Advance,

Mady

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

ok

you are correct

try this one

View solution in original post

10 Replies
swuehl
MVP
MVP

Hi,

are you using variables within your aggr? (Just thinking because of the 'v' at the beginning of field Names)

If so, what do they look like?

If not, the expression look good to me, could you post a small sample app here?

Regards,

Stefan

erichshiino
Partner - Master
Partner - Master

Does it work if you select only one Calendar.YearMonth?

Does it work without Aggr ?  (sum(vLastFctPayment.Amount)-(sum(Expenses.Expenses)-sum(vLastFctPayment.ServicingFee))

Not applicable
Author

Hello Erich,

yes it works for one Calendar.YearMonth and even the expression works normally if I dont add AGGR. But when I use it in a pivot or else where I have problem without the AGGR().

I have a sample, just not sure how to attach a QVW here. Its a real pain.

Can you please help?

Thanks

Mady

Not applicable
Author

Sample attache now, please check the first post.

Thanks,

Mady

lironbaram
Partner - Master III
Partner - Master III

hei

try this one

hope its helps you

Not applicable
Author

Hello Liron,

I am sorry but I was trying to get the running totals, and in your attachment it looks like, its not working. Please correct me if I am missing something here.

Thanks again for your effort.

lironbaram
Partner - Master III
Partner - Master III

ok

you are correct

try this one

swuehl
MVP
MVP

Lirons solution looks ok, to me.

An alternative using rangesum:

=rangesum(before(sum(Amount),0, columnNo()))

Please take care, if you change the pivot orientation (Year-Month vertical instead of horizontal) you must replace before() with above() and columnNo() with rowNo().

Not applicable
Author


Hello Liron,

Thankyou for the help and I think I am getting what I wanted, But what if the expression for month calculation is

sum(Amount) - (sum(Expenses)-sum(vLastFctPayment.ServicingFee) ) how do I add this to the formula which is suggested by you here as seen:

=sum(Amount)+if(isnull(after(sum(Amount))),0,after([Amount1]))

Thanks Again,

Mady