Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ramsingh
Contributor
Contributor

If condition and Flag creation

Hi All ,

I have below table and 3 fields .

I wann create Flag in Backend , For each ID , if For Price is" Yes" Atleast once (Greater or equal to 1) then Flag as 1 else 0

IDCountryFor PriceFLAG ( to be created in backend )
1AQYes1
1AWNo1
1AENo1
2AENo0
2AQNo0
3AWYes1
3ASYes1
4AENo1
4AQYes1

 

Advance Thanks

1 Solution

Accepted Solutions
Kushal_Chawda

try below

Data:
LOAD ID, 
     Country, 
     [For Price]
FROM
[https://community.qlik.com/t5/Qlik-Sense-App-Development/If-condition-and-Flag-creation/td-p/1737817]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Left Join(Data)
LOAD ID,
     Concat([For Price],',') as [All For Price]
Resident Data
Group by ID;

Final:
LOAD *,
     if(Index([All For Price],'Yes'),1,0) as Flag
Resident Data;

DROP Table Data;

DROP Field [All For Price];

 

Annotation 2020-08-21 160651.png

View solution in original post

2 Replies
Kushal_Chawda

try below

Data:
LOAD ID, 
     Country, 
     [For Price]
FROM
[https://community.qlik.com/t5/Qlik-Sense-App-Development/If-condition-and-Flag-creation/td-p/1737817]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Left Join(Data)
LOAD ID,
     Concat([For Price],',') as [All For Price]
Resident Data
Group by ID;

Final:
LOAD *,
     if(Index([All For Price],'Yes'),1,0) as Flag
Resident Data;

DROP Table Data;

DROP Field [All For Price];

 

Annotation 2020-08-21 160651.png

Ramsingh
Contributor
Contributor
Author

Thanks Kush 

works Fine .

Just a small query .
can you suggest what approach can i take instead of left join cause when i ran it took 30 min for 14 million records