Hey guys,
Hope you can help me with this problem.
I want to create a table in which I have values for current day and for previous day.
The script looks something like :
NoConcatenate
temp:
LOAD
if(match(kpiNo,15,16,17,18,19,20,21),Value01*(-1),Value01) as Value1,
DATE,
Name_Kpi,
kpiNo;
LOAD sum(Value) as Value01,
date( floor( DATE ))as DATE,
Name_Kpi,
kpiNo
Resident BS
Group By DATE,
Name_Kpi,
kpiNo;
drop Table BS;
NoConcatenate
tmpBS:
LOAD
Value1 as Value,
DATE,
Name_Kpi,
kpiNo,
'CD' as PointInTimeVersion
Resident temp;
Concatenate(tmpBS)
LOAD
if(Name_Kpi =Previous(Name_Kpi), Previous(Value1),0) as Value,
DATE,
Name_Kpi,
kpiNo,
'PD' as PointInTimeVersion
Resident temp
Order by kpiNo,DATE;
drop Table temp;
But the problem is that for Previous Day I`m getting same values as for current day. Can you please help me? Or if you know another way to calculate Previous Day in Loading Script please tell me.
Thanks,
Razvan