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: 
haribabugv
Creator
Creator

Aggregate multiple dimensions in rangesum expression

Hello Users,

Can you please check what is wrong in my expression . I am trying to calculate column called Balance in Qlikview as shown in excel.

 

sum(aggr(If(Rowno()>1,RangeSum(above([Balance])-sum(Plan)
,0,NoOfRows())),sum(Opening)-sum(Plan),Date,Material)) 

 

MaterialDatePlanOpeningBalance
A10-03-2019136451
A11-03-201916 35
A12-03-201914 21
A13-03-201916 5
A14-03-201911 -6
B10-03-2019123220
B11-03-201920 0
B12-03-201912 -12
B13-03-201919 -31
B14-03-201913 -44

 

Labels (3)
4 Replies
tresesco
MVP
MVP

Try this:

If(Sum(Opening)=0,above([Balance])-sum(Plan),sum(Opening)-sum(Plan))
shiveshsingh
Master
Master

Try this

 

T:LOAD * INLINE [
Material, Date, Plan, Opening
A, 10-03-2019, 13, 64
A, 11-03-2019, 16,
A, 12-03-2019, 14,
A, 13-03-2019, 16,
A, 14-03-2019, 11,
B, 10-03-2019, 12, 32
B, 11-03-2019, 20,
B, 12-03-2019, 12,
B, 13-03-2019, 19,
B, 14-03-2019, 13,

];
F:
load if(RowNo()=1,Opening - Plan, if(Material = Peek(Material), Peek(Balance)-Plan, Opening-Plan )) as Balance,*

Resident T;

drop table T;

haribabugv
Creator
Creator
Author

Hey Shivesh, 

Thanks . Is there any way i can do that in chart by creating expression?

haribabugv
Creator
Creator
Author

Hello Tresesco,

There are cases where Opening can be zero even for the 1st record. SO this solution may not work