Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
DummyData:
load*,if("Company"='C 4',test1) as test2;
load *, if("Company"='C 34',[Business Unit]) as test1;
LOAD * INLINE [
Company, Business Unit
C 34, BU A
C 4, BU B
C 4, BU C
C 4, BU D
C 4, BU E
];
/*
t1:
load *,
if("Company"='C 4',test1) as test2
Resident DummyData;
drop Table DummyData;*/
Neither preceding nor resident works, please explain why this does not work.(Any solution without Mapping Table)
Thanks
Check your data has c4..
But your p.load having pc 4
DummyData:
LOAD *,
IF(Company = 'C 4', test1) AS test2;
LOAD *,
IF(Company = 'C 34', [Business Unit]) AS test1
INLINE [
Company, Business Unit
C 34, BU A
C 4, BU B
C 4, BU C
C 4, BU D
C 4, BU E
];
This is what happens:
1) A table is created with two fields: Company, Business Unit
2) A new field is added, called "test1". On the row where Company='C 34' it holds the value 'BU A', on all other rows it is empty (null).
3) Yet another field is created, "test2". It is empty (null) on all rows, since the field test1 is empty on the rows where Company='C 4' (and the if-statement assigns no value to rows where Company is anything but 'C 4').