Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gireesh1216
Creator II
Creator II

Need Help on calculating Column

Hello Team,

Please help me on below scenario. 

we have raw data like below:

IDNAMEDSTATUS
1216GIREESHD1PASS
1216GIREESHD2 
1216GIREESHD3 
1216GIREESHD4 
1217NARESH FAIL
1217NARESHD5 
1217NARESHD6 
1217NARESHD7 

 

Result: Need STATUS as New Status column if ID and NAME is same.

IDNAMEDSTATUSNew Status
1216GIREESHD1PASSPASS
1216GIREESHD2 PASS
1216GIREESHD3 PASS
1216GIREESHD4 PASS
1217NARESH FAILFAIL
1217NARESHD5 FAIL
1217NARESHD6 FAIL
1217NARESHD7 FAIL
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Use this pattern:

DATA:
LOAD ID, NAME, D, STATUS as TSTATUS
FROM ....;

JOIN(DATA)
LOAD ID, NAME, TSTATUS as STATUS
WHERE Len(TSTATUS) > 0;

DROP Field TSTATUS;

This assumes that there is never more than one instance of ID and NAME with a status. If that is not a safe assumption, then use this for the join instead:

JOIN(DATA)
LOAD ID, NAME, MaxString(TSTATUS) as STATUS
WHERE Len(TSTATUS) > 0
GROUP BY ID, NAME;

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
Anil_Babu_Samineni

Answer here - https://community.qlik.com/t5/QlikView-App-Development/Need-Help/m-p/1658776/highlight/false#M448554

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jonathandienst
Partner - Champion III
Partner - Champion III

Use this pattern:

DATA:
LOAD ID, NAME, D, STATUS as TSTATUS
FROM ....;

JOIN(DATA)
LOAD ID, NAME, TSTATUS as STATUS
WHERE Len(TSTATUS) > 0;

DROP Field TSTATUS;

This assumes that there is never more than one instance of ID and NAME with a status. If that is not a safe assumption, then use this for the join instead:

JOIN(DATA)
LOAD ID, NAME, MaxString(TSTATUS) as STATUS
WHERE Len(TSTATUS) > 0
GROUP BY ID, NAME;

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein