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

Create new fields combined two fields with condition

For the below table add a Newfield which is B_ID if present but the C_ID, if B_ID not present, add a symbol like a '-' to see the difference. Refer the screenshot for better understanding.

Capture.JPG

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Load

     *,

     If(Len(trim(B_ID))>0, B_ID, '-'&C_ID) as New_ID

;

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];

View solution in original post

1 Reply
tresesco
MVP
MVP

Try like:

Load

     *,

     If(Len(trim(B_ID))>0, B_ID, '-'&C_ID) as New_ID

;

LOAD * INLINE [

    A_ID, B_ID, C_ID

    1, 123, 1111

    2, 234, 2222

    3, , 3333

    4, , 4444

    5, 345, 5555

];