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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
erric3210
Creator
Creator

Reverse Row Value for ID

Hi All,

I've ID and against that there is one flag which has 1 & 2 values. I want 2nd value for 1st flag and 1st value for 2nd flag.

Is there any simple code for this.

This is my requirement:

Community_Post.png

For reference, below is the Inline Code:

LOAD * INLINE [
ID, Group_Name, Flag_New, Amount
"Test_Code1", AAA, 1, 40000
"Test_Code1", BBB, 2, 55000
"Test_Code2", CCC, 1, 88000
"Test_Code2", DDD, 2, 91000
"Test_Code3", EEE, 1, 62000
"Test_Code3", FFF, 2, 20000
];

 

Regards,

Eric

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@erric3210  One Option :

Data:
LOAD * INLINE [
ID, Group_Name, Flag_New, Amount
"Test_Code1", AAA, 1, 40000
"Test_Code1", BBB, 2, 55000
"Test_Code2", CCC, 1, 88000
"Test_Code2", DDD, 2, 91000
"Test_Code3", EEE, 1, 62000
"Test_Code3", FFF, 2, 20000
];

left join 

load pick(Match(Flag_New,'1','2'),'2','1') as Flag_New,ID,Amount as Desired_output resident Data;

 

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@erric3210  One Option :

Data:
LOAD * INLINE [
ID, Group_Name, Flag_New, Amount
"Test_Code1", AAA, 1, 40000
"Test_Code1", BBB, 2, 55000
"Test_Code2", CCC, 1, 88000
"Test_Code2", DDD, 2, 91000
"Test_Code3", EEE, 1, 62000
"Test_Code3", FFF, 2, 20000
];

left join 

load pick(Match(Flag_New,'1','2'),'2','1') as Flag_New,ID,Amount as Desired_output resident Data;

 

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
erric3210
Creator
Creator
Author

Hi Taoufiq ZARRA,

Thanks for the Solution. It worked.

 

Regards,

Eric