Try it like this:
[Sum of Units packed in recent 30 days],
(TODAY() - MinDate30) AS [Diff. of days in 30 days time frame],
[Sum of Units packed in recent 30 days]/(TODAY() - MinDate30) as Velocity;
Sum([Units Packed 30]) as [Sum of Units packed in recent 30 days],
Min(FilteredDate30) AS MinDate30
GROUP BY SKU#;
[Units Packed] AS [Units Packed 30],
[Ship Date] AS FilteredDate30
WHERE [Ship Date] > TODAY()-31;
LOAD Sum(Velocity) as [Total Velocity]
Velocity/[Total Velocity] as [Relative Velocity %]
Drop Table Table2;
Your script did the magic sunny.
One last question friend.
I'm trying to do the full accumulation for [Relative Velocity %] in the script, because i want it as a dimension so as to seperate the accumulation into buckets per %.
Is "rangesum(above(sum([Relative Velocity %]),0,rowno(total )))" accurate??
Add this after table 3
Alt(Peek('Cumulative Relative Velocity %'), 0) + [Relative Velocity %] as [Cumulative Relative Velocity %]
Order By ...;
Drop Table Table3;
You will need a order by statement to make sure the accumulation occurs in the order you want.
Give it a shot and see if it works.