I am trying to count the current consecutive weeks an item is below its average for a given period of time starting with the past week. Not sure how to do this. Item 123 should have an output of 3 since it has been below the average the past 3 weeks. Item 1234 should have an output of 0 since it was above the average last week.
[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]Item[/TD]
[TD]10/20[/TD]
[TD]10/27[/TD]
[TD]11/3[/TD]
[TD]11/10[/TD]
[TD]Avg[/TD]
[TD]Consecutive WK Below Avg[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]15[/TD]
[TD]8[/TD]
[TD]7[/TD]
[TD]6[/TD]
[TD]9[/TD]
[TD]???[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD]15[/TD]
[TD]14[/TD]
[TD]10[/TD]
[TD]15[/TD]
[TD]13[/TD]
[TD]???[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]Item[/TD]
[TD]10/20[/TD]
[TD]10/27[/TD]
[TD]11/3[/TD]
[TD]11/10[/TD]
[TD]Avg[/TD]
[TD]Consecutive WK Below Avg[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]15[/TD]
[TD]8[/TD]
[TD]7[/TD]
[TD]6[/TD]
[TD]9[/TD]
[TD]???[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD]15[/TD]
[TD]14[/TD]
[TD]10[/TD]
[TD]15[/TD]
[TD]13[/TD]
[TD]???[/TD]
[/TR]
</tbody>[/TABLE]