Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Create new flag using existing Flag

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)

 

5 Replies
Claudiu_Anghelescu
Specialist
Specialist

=IF(MonthDiff <37 AND MonthDiff > 61), 'Flag3') as Flag

To help community find solutions, please don't forget to mark as correct.
anushree1
Specialist II
Specialist II

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

karan_kn
Creator II
Creator II
Author

Thanks for the response, but the flag getting blank. It's not accepting to merge two values.

anushree1
Specialist II
Specialist II

can u share the sample file

karan_kn
Creator II
Creator II
Author

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;