I'm looking to replicate an if statement into my Hive code. Essentially, I have spend from 2014-2018 for a corresponding client, I'm trying to understand the last year the client stopped spending with us and what the loss in $ is based on the previous year's spend. I can't do a CASE statement since there's a couple of variables that I'm looking at for every IF statements but I'm open to suggestions!
If (FY_2014 > 0, (If(FY_2015 = 0, FY_2014,0)), 0) as '2014to2015'
If (FY_2015 > 0, (If(FY_2016 = 0, FY_2015,0)), 0) as '2015to2016'
If (FY_2016 > 0, (If(FY_2017 = 0, FY_2016,0)), 0) as '2016to2017'
If (FY_2017 > 0, (If(FY_2018 = 0, FY_2017,0)), 0) as'2017to2018'
Thanks in advance for your help guys!
Aucun commentaire:
Enregistrer un commentaire