Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I have got below scenario -
Status code | PR_1 | PR_2 | Final |
P1 | 08/08/19 | 09/07/19 | 0 |
P2 | 04/08/18 | - | |
P2 | 07/0618 | - | |
P3 | 06/03/19 | 12/01/19 | 0 |
So I need If condition as -
If Status code ='P2' and PR_1 is blank or PR_2 is blank , then i need to place dash('-') in the Final Column or need to Place 0. ( As shown in the above table)
Currently i have written the below code and its not working :-
if(([Status code] = 'P2') and ([PR_1] = ' ' ) or ([PR_2]= ' '),[Final] = ' -',0)
Could some one guide me with the best method, Maybe using Is null in If Condition
Thanks in advance,
LP27
It is working on my side. Please see the attached file:
You can also use the below code and you will get the same result:
Data:
Load *,
if([Status code] = 'P2' and (Len([PR_1]) = 0 ) or (Len([PR_2])= 0),'-',0) as Final;
Load * Inline [
Status code, PR_1, PR_2
P1, 08/08/19, 09/07/19
P2, 04/08/18,
P2,,07/0618
P3, 06/03/19, 12/01/19
];
Please give a try with the below code:
Data:
Load *,
if([Status code] = 'P2' and ([PR_1] = '' ) or ([PR_2]= ''),'-',0) as Final;
Load * Inline [
Status code, PR_1, PR_2
P1, 08/08/19, 09/07/19
P2, 04/08/18,
P2, ,07/0618
P3, 06/03/19, 12/01/19
];
It is working on my side. Please see the attached file:
You can also use the below code and you will get the same result:
Data:
Load *,
if([Status code] = 'P2' and (Len([PR_1]) = 0 ) or (Len([PR_2])= 0),'-',0) as Final;
Load * Inline [
Status code, PR_1, PR_2
P1, 08/08/19, 09/07/19
P2, 04/08/18,
P2,,07/0618
P3, 06/03/19, 12/01/19
];