Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
2 weeks old into QV, and trying to get on board with the basics.
I have data in columns, SalesID, LA, LP, VO. There are basically 2 values on columns LA,LP, VO, either 1 or 0. I would like to create a 5th column that checks that if there is 0 on any of the columns in the row, then the new row value is 1, otherwise it is 0.
if((LAr or VO or LP) = 0, 0, 1) as VR. This however doesn't work.
After this would like to create 4 new tables.
SalesID, LA =1
SalesID, VO =
SalesID, LP =1
SalesID, VR =1
Help on this much appreciated...
Try
IF(LA&LP&VO = 000, 0, 1) as VR
UPDATE : My mistake in previous reply. I overlooked your requirements. I thought you want VR = 0 if all LA, LP and VO are 0...
you can use below...
Temp:
Load * Inline
[
SalesID, LA, LP, VO
A, 0,0,1
B, 0,1,0
C, 0,0,1
D, 0,0,0
E, 0,1,1
F, 1,1,1
];
NoConcatenate
FINAL:
Load
SalesID,
IF(LA= 0 or LP = 0 or VO = 0,0,1) as VR
Resident Temp;
the sysntax is:
if(LAr=0 or VO=0 or LP=0, 0, 1) as VR
Write like
If ( LA = 0 OR VO = 0 OR LP = 0, 1, 0) as VR
Hope this helps
cheers but this didn't work since I was looking that if any of the columns have a different value and not that if all of them have 0 values.
Thanks. Works like a charm
Check my second solution...
Or you can add this in your load statement like
If ( (LA = 0 OR VO = 0 OR LP = 0), 1, 0) as VR
Hope this helps
Hi again,
The above was a 2 part question, sorry for the unclarity. So part 2, how would I then create for tables where:
SalesID, LA = only 1
SalesID, VO =only 1
SalesID, LP =only 1
SalesID, VR =only 1
both work Anand. cheers