Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Hello there.
I solved the problem. The script was ok with Previous() function , but it was a problem of ordering column.
May be this?
if(Name_Kpi =Previous(Name_Kpi), Alt(Peek('Value'),0) as Value
I have tried with Peek() function , but , after reload , I`m not getting any value. It brings blank values. Do you know what the problem might be?
Thank you
What I have noticed , is that when I use Previous(Value) , I get only for a few kpi`s the previous value , and the rest of the kpi`s , keeps the current value.
Hello there.
I solved the problem. The script was ok with Previous() function , but it was a problem of ordering column.