In a straight table or pivot chart you can use the above() function: above(PRODUCT)
In the script you can use the previous() function: if(KEY=previous(KEY),previous(PRODUCT)) as PRIOR PRODUCT. You may have to create another table first if your source data isn't sorted on KEY first and MONTH next.
talk is cheap, supply exceeds demand