SQL - Negative Adjustment

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

SQL - Negative Adjustment

Hi All,

I have a scenario to build sql for the the following Negative value adjustment based on the key col and previous week's data making it positive.

No adjustment to be made if we don't find a positive value or the adjustment not making the -ve value to +ve. 

 

KeyColYear_Wk_NbrSales_ActualSales_Actual_Changed
A2016411515
A201642105
A201644-50
A20164555
B201631155
B201632-100
B2016332013
B201634-70
B2016351515
C201631-15-15
C201633-3-3
C201634-5-5
C2016351515
X201620199
X20162155
X201623-60
X201624-40
X2016251515

 

Thanks & Regards,

Abid

  • SQL