Key Change Function in Abinitio Roll Up
Watch my YouTube video for explanation :
Please look into the class notes here for your references:
How Key Change Function works in Rollup
in_date|amt
01012023|49
03012023|32
08012023|90
17012023|91
21012023|92
02022023|93
27022023|93
21022023|94
12042023|95
14042023|96
19042023|97
21042023|98
18062023|99
26062023|81
12062023|82
13072023|83
16072023|84
31072023|85
accululate the amount for the same week.
out:key_change(in1,in2)=
begin
let date("YYYY-MM-DD") converted_dt1=
(date("YYYY-MM-DD"))(string_concat(string_substring(in1.in_date,5,4),'-',string_substring(in1.in_date,3,2),'-',string_substring(in1.in_date,1,2));
let date("YYYY-MM-DD") converted_dt2=
(date("YYYY-MM-DD"))(string_concat(string_substring(in1.in_date,5,4),'-',string_substring(in1.in_date,3,2),'-',string_substring(in1.in_date,1,2));
out::if(date_week_of_year(converted_dt1) != date_week_of_year(converted_dt2) or l_year1!=l_year2) 1 else 0;
end;
out:rollup(in)=
begin
out.week_year::string_concat(date_week_of_year(in1.in_date),l_year);
out.weekly_amt::sum(in.amt);
end;
Fore more Abinitio, AWS and data engineering videos please subscribe , view , like and share my YouTube channel
Click DataPundit
Comments
Post a Comment