Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Here I have 2 columns where ever i have MKT and MGT in DEPT column these both need to summed together and other deparments need to summed individually it should be written in load script only.
DEPT SALARY
MKT 33500
MGT 45000
LIB 22000
RND 27500
FIN 42000
output should be
salary
78500(MKT+MGT)
22000 (LIB)
27500 (RND)
42000 (FIN)
If any suggestions kindly help
In Load script create new Dept as
If (wildmatch(Dept,'MKT','MGT'),'MKT+MGT',Dept) as New_Dept
I need the sum salary of those 2 departments and other departments individually
salary
78500 (MKT+MGT)
22000 (LIB)
27500 (RND)
42000 (FIN)
If you use new dept field it will sum up salary for those to dept in one under MKT+MGT
Hi,
Please use the code as Shradda suggested.
Temp:
Load * inline
[
DEPT, SALARY
MKT ,33500
MGT, 45000
LIB ,22000
RND, 27500
FIN, 42000
];
Load *, If (wildmatch(DEPT,'MKT','MGT'),'MKT+MGT',DEPT) as New_Dept Resident Temp;
drop Table Temp;
Regards,
Ajay
Use this script:
tmp:
LOAD salary
,If(Match(dep, 'MKT', 'MGT'), 'MKT & MGT', dep) as dep
INLINE [
dep, salary
MKT, 33500
MGT, 45000
LIB, 22000
RND, 27500
FIN, 42000
];
Table:
LOAD dep
,Sum(salary) as [Sum of salary]
Resident tmp
Group By dep
;
DROP Table tmp;
The result would be calculated in the script and the output would look like this:
!