Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
razvan_brais
Creator III
Creator III

Point in time in Loading Script

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

1 Solution

Accepted Solutions
razvan_brais
Creator III
Creator III
Author

Hello there.

I solved the problem. The script was ok with Previous() function , but it was a problem of ordering column.

View solution in original post

4 Replies
Anil_Babu_Samineni

May be this?

if(Name_Kpi =Previous(Name_Kpi), Alt(Peek('Value'),0) as Value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
razvan_brais
Creator III
Creator III
Author

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

razvan_brais
Creator III
Creator III
Author

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.

razvan_brais
Creator III
Creator III
Author

Hello there.

I solved the problem. The script was ok with Previous() function , but it was a problem of ordering column.