Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
tomovangel11
Partner - Contributor
Partner - Contributor

Rangesum working correctly, but Totals are not right?

Hello guys, 
seems like my old account is not accessible so I have a new one, which is almost empty. 
I have come with the following question to you guys 🙂 

tomovangel11_0-1626684805354.png

This is my table, 
It's made up from a dynamic dimension in the column(0,30,60,90). and a Month/year field in the Column's section.


My dynamic dimension:

=if(aggr((payment_date-duedate),ir_id,ref_nr,payment_date)<=$(vTolerance),Dual($(vTolerance),1),
if(aggr((payment_date-duedate),ir_id,ref_nr,payment_date)<=30,dual('30',2),
if(aggr((payment_date-duedate),ir_id,ref_nr,payment_date)<=60,dual('60',3),
if(aggr((payment_date-duedate),ir_id,ref_nr,payment_date)<=90,dual('90',4)))))

My expression, which is not summing up totals correctly:

Tried this, results is the same as in chart:

RangeSum(
Above(sum(aggr(RangeSum(
Above(
Sum({$<payment_date={"<$(=Only(ReportDate))"}
,duedate={">=$(=Only(StartDate)) <=$(=Only(EndDate))"},active_date={">=$(=$(vStart)) <=$(=$(vEndDate))"},BankFlag={'1'}>}paid_sum_res)

,0,RowNO())),ir_id,payment_date,ref_nr,DUEDATEGROUP)),0,RowNO()))

original expression is:

RangeSum(
Above(
Sum({$<payment_date={"<$(=Only(ReportDate))"}
,duedate={">=$(=Only(StartDate)) <=$(=Only(EndDate))"},active_date={">=$(=$(vStart)) <=$(=$(vEndDate))"},BankFlag={'1'}>}paid_sum_res)

,0,RowNO())).

 

My goal is after every period from the calculated dimension, to sum up with the previous period. 
In the totals table, as you can see everything except the last total is incorrect. I have literally read through all Rangesum posts and comments etc.
Any help will be appriciated.
For a demo, it will be a bit hard, since all the data is customer confidential, and reproducing the same table will prove very hard for a demo purpose.

I really hope someone had this problem and fixed it with something very simple which is just eluding me.
Thanks!

 

 

2 Replies
Kushal_Chawda

@tomovangel11  try before function instead of above in rangesum

tomovangel11
Partner - Contributor
Partner - Contributor
Author

I tried it, I also tried 

rangesum(before(RangeSum(
Above(
Sum({$<payment_date={"<$(=Only(ReportDate))"}
,duedate={">=$(=Only(StartDate)) <=$(=Only(EndDate))"},active_date={">=$(=$(vStart)) <=$(=$(vEndDate))"},BankFlag={'1'}>}paid_sum_res)

,0,RowNO())),0,columnno()))

 

Basically I want the Rangesum to itterate over Rows, and add each value to the next row from the calculated dimension. 

BUt the total then, is not showing the correct value on the last rows, which is why I am trying to figure out where I am doing and what wrong.