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: 
mfj2405
Contributor
Contributor

Flag Employee Rows with Code Value 'P'

I am trying to identify and flag Employees with a Code Value of 'P' but I want to flag all rows for that Employee not just the rows with the 'P' value.  Here is an example.  How can I do this?

Employee IDCodeHas Value P
12345AY
12345BY
12345PY
98765AN
98765BN
98765CN
Labels (1)
1 Solution

Accepted Solutions
robert_mika
Master III
Master III

Data:
load * inline [

Employee ID,Code
12345, A
12345, B
12345, P
98765, A
98765, B
98765, C
];

map_P:
mapping load
"Employee ID",
Code
Resident Data
where Code='P';

Final:
Load
"Employee ID",
Code,
If(applymap('map_P', "Employee ID")='P','Y','N') as "Has Value P"
Resident Data;

drop table Data;

 

 

robert_mika_0-1757605447187.png

 

View solution in original post

1 Reply
robert_mika
Master III
Master III

Data:
load * inline [

Employee ID,Code
12345, A
12345, B
12345, P
98765, A
98765, B
98765, C
];

map_P:
mapping load
"Employee ID",
Code
Resident Data
where Code='P';

Final:
Load
"Employee ID",
Code,
If(applymap('map_P', "Employee ID")='P','Y','N') as "Has Value P"
Resident Data;

drop table Data;

 

 

robert_mika_0-1757605447187.png