Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hoowling
Contributor III
Contributor III

Accumulated percentage in Chart

Hi Community, 

I want to calculate the accumulated percentage of two expressions, where the second one should be divided by the first one: 

First expression: 
if(weekday(vLoadDatePlanData)='Mon',Sum({$<YearWeek = {$(=max({$} YearWeek)-1)},%Date={'<$(=vLoadDatePlanData)'}>} aggr(
_cntPlandata*_flgMaxOpNumber
,%CONO%FACI%REAR%PLGR%MFNO%OPNO%PRNO%WEEK)), Sum({$<YearWeek = {$(=max({$} YearWeek))},%Date={'<$(=vLoadDatePlanData)'}>} aggr(
_cntPlandata*_flgMaxOpNumber
,%CONO%FACI%REAR%PLGR%MFNO%OPNO%PRNO%WEEK))

Second expression: 
if(weekday(vLoadDatePlanData)='Mon',
(
Sum({$<YearWeek = {$(=max({$} YearWeek)-1)},%Date={'<$(=vLoadDatePlanData)'}
>} aggr(
if(sum(([Manufactured quantity]*_flgMaxOpNumber)/([Remaining qty]*_flgMaxOpNumber))>$(vAcceptancePercentage),1,
if(_flgSetOK=1,1,0))
,%CONO%FACI%REAR%PLGR%MFNO%OPNO%PRNO%WEEK))
)
,
Sum({$<YearWeek = {$(=max({$} YearWeek))},%Date={'<$(=vLoadDatePlanData)'}
>} aggr(
if(sum(([Manufactured quantity]*_flgMaxOpNumber)/([Remaining qty]*_flgMaxOpNumber))>$(vAcceptancePercentage),1,
if(_flgSetOK=1,1,0))
,%CONO%FACI%REAR%PLGR%MFNO%OPNO%PRNO%WEEK))
))

I've tried using the "full accumulation" function in the chart properties, which yields the correct numbers for the two expressions, but not for the percentage: Column(2)/Column(1). 

I think I need to make use of Rangesum(), Above(), Below() to make this work. Any suggestions? 

Hoowling_0-1600761613062.png

 

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Should just be

RangeSum(Above(Expression2, 0, RowNo()))
/
RangeSum(Above(Expression1, 0, RowNo()))

Just replace Expression1 and Expression2 with there expressions

View solution in original post

2 Replies
sunny_talwar

Should just be

RangeSum(Above(Expression2, 0, RowNo()))
/
RangeSum(Above(Expression1, 0, RowNo()))

Just replace Expression1 and Expression2 with there expressions

Hoowling
Contributor III
Contributor III
Author

Worked perfectely - thanks!