Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to create additional flag sum of two flags (Flag1 + New)
Table:
LOAD *,
IF(MonthDiff >= 1 AND MonthDiff <= 36, 'Flag1',
IF(MonthDiff >=37 AND MonthDiff <= 60, 'Flag2','New'))) AS DateFlag
Add one more Flag (Flag1 +'New' = Flag3)
=IF(MonthDiff <37 AND MonthDiff > 61), 'Flag3') as Flag
Use Preceeding Load , like below:
Table:
Load *,
Flag1 +New as Flag3
LOAD *,
IF(MonthDiff >= 1 AND MonthDiff <= 36, 'Flag1',
IF(MonthDiff >=37 AND MonthDiff <= 60, 'Flag2','New'))) AS DateFlag
From <<.....>>
or Resident Load like:
Temp:
LOAD *,
IF(MonthDiff >= 1 AND MonthDiff <= 36, 'Flag1',
IF(MonthDiff >=37 AND MonthDiff <= 60, 'Flag2','New'))) AS DateFlag
From <<.....>>
Table:
Load *,
Flag1 +New as Flag3
resident Temp;
Drop table Temp;
Hope Flag1 and New are Numerical Entries
Thanks for the response, but the flag getting blank. It's not accepting to merge two values.
can u share the sample file
create new flag Flag3 + New =Flag4
Script:
T1:
LOAD *,
IF(MonthDiff >= 1 AND MonthDiff <= 12, 'Flag1',
IF(MonthDiff >=13 AND MonthDiff <= 36, 'Flag2',
IF(MonthDiff >=37 AND MonthDiff <= 60, 'Flag3','New'))) AS DateFlag
LOAD *,
IF(ISNULL(Max_Sales_Date) = -1, 'Null', ((year(Sales_Date)*12)+month(Sales_Date)) - (((year(Max_Sales_Date)*12)+ month(Max_Sales_Date)))) AS MonthDiff
Resident Temp;
DROP Table Temp;