Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Should just be
RangeSum(Above(Expression2, 0, RowNo()))
/
RangeSum(Above(Expression1, 0, RowNo()))
Just replace Expression1 and Expression2 with there expressions
Should just be
RangeSum(Above(Expression2, 0, RowNo()))
/
RangeSum(Above(Expression1, 0, RowNo()))
Just replace Expression1 and Expression2 with there expressions
Worked perfectely - thanks!