Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts.
I need your help in the following.
Data :
Pdate | Contry | DEPT | PLACE | VALUE |
1-Jan-21 | INDIA | AA | BB | GET |
5-Jan-21 | INDIA | AA | BB | BUY |
10-Jan-21 | INDIA | AA | BB | BUY |
Output :
P_date | Contry | DEPT | PLACE | VALUE | Get_date |
5-Jan-21 | INDIA | AA | BB | BUY | 1-Jan-21 |
10-Jan-21 | INDIA | AA | BB | BUY | 1-Jan-21 |
In this case, whenever we have a column whose value is "BUY" then it has to search if there is a Value "GET" previously and insert the p_date in the new column. so for each BUY we need to get the previous "Get" date.
In the load script.
Please help.
@Bansal_Kumar may be this
map_get_date:
mapping LOAD Distinct Contry & DEPT & PLACE as Key,
Pdate
FROM Table
where VALUE ='GET';
Final:
LOAD *,
applymap('map_get_date',Contry & DEPT & PLACE,'NA') as get_date
FROM Table
where VALUE ='BUY';