Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
swarnendu
Creator II
Creator II

auto generate value using script

Hi all,

I am facing a problem in script level.

Which is i need to create auto generate value using script.

my example is

Item NoItem idDateValuevalue2
201310101/01/20170100
201310102/01/20170100
201310103/01/2017100100
201310104/01/20170100
201310105/01/20179090
201310106/01/2017090
201310201/01/20170200
201310202/01/2017200200
201310203/01/20170200
201310204/01/2017170170
201310205/01/20170170

please see my table i have 3 dimension which is item no , item id and date,

and also a measure which name is value i need like value2 measure  using script.

If you have any solution then please suggest me.

Thanks and regards

Swarnendu

11 Replies
qliksus
Specialist II
Specialist II

Attachment is restriced in my environment  but here is the script

Script:

A:
LOAD * INLINE [
   
    ItemNo, Itemid, Date, Value, value2
    2013, 101, 01/01/2017, 0, 100
    2013, 101, 02/01/2017, 0, 100
    2013, 101, 03/01/2017, 100, 100
    2013, 101, 04/01/2017, 0, 100
    2013, 101, 05/01/2017, 90, 90
    2013, 101, 06/01/2017, 0, 90
    2013, 102, 01/01/2017, 0, 200
    2013, 102, 02/01/2017, 200, 200
    2013, 102, 03/01/2017, 0, 200
    2013, 102, 04/01/2017, 170, 170
    2013, 102, 05/01/2017, 0, 170
];


A1:
load

ItemNo,
Itemid, Date, Value , if(Peek(Itemid)=Itemid and Value=0, Peek(Value),Value) as Values

Resident A
order by ItemNo,Itemid,Date
;

A2:
load

ItemNo,
Itemid, Date, Value , if(Peek(Itemid)=Itemid and Values=0, Peek(Valuesfinal),Values) as Valuesfinal

Resident A1
order by ItemNo,Itemid,Date desc
;


DROP Table A,A1 ;

Front End:

swarnendu
Creator II
Creator II
Author

Hello brother please look at this discussion hope you can help me.

https://community.qlik.com/message/1410521#1410521