Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
with below fields, I need to give name for the Null values in the pie chart
Load * Inline [ID,NAME,DEPT
1,AA,10
2,BB,20
3,CC,30
];
Load * Inline[ DEPT,DNAME
10,DDD
20,EEE
30,FFF
40,GGG
50,HHH
];
Here my expression is count id and dimension is DEPT
So due to the null values (40,50) I have to give the name "yet to assign"
I would do my second table as a mapping load and create a bucket for all that do not map to a DNAME so they will always be selectable/available.
Base_Table:
Load * Inline [ID,NAME,DEPT
1,AA,10
2,BB,20
3,CC,30
];
Dept_Map:
mapping
Load * Inline[ DEPT,DNAME
10,DDD
20,EEE
30,FFF
40,GGG
50,HHH
];
New_Table:
Load
*,
applymap('Dept_Map', DEPT, 'Yet to Assign') as DNAME
Resident Base_Table;
Drop table Base_Table;
In the dimensions - Add calculated dimension
=IF(ISNULL(DNAME), 'Yest to assign', DNAME)
Carly has given you the one best and optimized way to implement this by Applymap() function.
You can even use Left join too.
Table1:
Load * Inline [ID,NAME,DEPT
1,AA,10
2,BB,20
3,CC,30
];
Table2:
Load * Inline[ DEPT,DNAME
10,DDD
20,EEE
30,FFF
40,GGG
50,HHH
];
Left join(Table1)
load
DEPT
,DEPT as Dept2
,DNAME
resident Table2;
drop table Table2;
Data:
Load *
,if(DEPT<>Dept2,'Yet to be Assigned') as Department
resident Table1;
drop table Table1;
=if((Dname)='-','yet to assign',Dname)