7-Day Rolling Sum with Increase Flag

SQL coding challenge · Difficulty: medium · +200 XP

Your sales dashboard shows a "trend flag" next to the rolling total. If today's 7-day rolling sum is higher than yesterday's, flag it as 'UP'. Otherwise flag it as 'FLAT/DOWN'.

Return: date, rolling_7day_sum, trend_flag ('UP' or 'FLAT/DOWN')

Sort by date ascending.

Solve this challenge on PySpark.in