Average of PO's per week over multiple weeks

Hello Everyone,

I need to compare for each Vendor the amount of PO’s of last week to the average number of PO’s per week of the 12 weeks before (from today -2 until -13). I’m only not totally sure on how I can solve this issue?

I use this formula for the amount of PO’s of last week.
PU_COUNT_DISTINCT(“LFA1”, “EKKO”.“EBELN”,
(CASE WHEN ROUND_WEEK(“EKKO”.“TS_AEDAT”) = ADD_DAYS(ROUND_WEEK(TODAY()),-7) THEN 1.0 ELSE 0.0 END)=1.0)

And tried using Moving Average for the average over multiple weeks, but I’m not getting this solved in a way which would provide me with just 1 average.

Table need to look like this:
Vendor PO’s last week Average # PO’s per week over the earlier 12 weeks
XYZ 8 3,2

Thanks in advance for any help on this topic.

Best Regards,

Pim

Solved it. I had to build further on the already build function.

PU_COUNT_DISTINCT(“LFA1”, “EKKO”.“EBELN”,
(CASE WHEN “EKKO”.“TS_AEDAT” BETWEEN ADD_DAYS(ROUND_WEEK(TODAY()),-91) AND ADD_DAYS(ROUND_WEEK(TODAY()),-14) THEN 1.0 ELSE 0.0 END)=1.0
)/12

1 Like