Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
QSense
Creator II
Creator II

if missing value exists get previous value

Hello,

I have a table that some year month's values are missing. On hand = previous on hand + input - output 

but if there is missing value on hand value is calculated wrongly. First table calculation is wrong.

Second table on hand calculation is true. 

since in 202006 previous on hand (30) input (1) - output (2) = 29

Please help.

IDY Minputoutputon hand 
12020025830 
1202003--- 
1202004--- 
1202005--- 
120200612-1 
12020071090 
120200834-1 
      

 

 

IDY Minputoutputon hand
12020025830
1202003---
1202004---
1202005---
12020061229
120200710930
12020083429
Labels (4)
1 Solution

Accepted Solutions
lorenzoconforti
Specialist II
Specialist II

It's working for me; see attached

you are clearly working on a different dataset as I can see date in between; maybe share your dashboard

View solution in original post

15 Replies
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try using Peek() or  Previous function.

Thanks

Thanks and Regards
Kashyap.R
QSense
Creator II
Creator II
Author

hello ,

It does not work . I tried.

lorenzoconforti
Specialist II
Specialist II

Peek works for me; see attached example with your data

PeekPreviousValue.png

QSense
Creator II
Creator II
Author

thanks for your reply,

in data missing values are "-" instead of "". when I changed  into "-" , ıt didint work.

lorenzoconforti
Specialist II
Specialist II

see attached

QSense
Creator II
Creator II
Author

thanks very much for fast reply. 

actually in my data missing values are not present . I mean , original data is 

IDY Minputoutputon hand
12020025830
12020061229
120200710930
12020083429

 

lorenzoconforti
Specialist II
Specialist II

Then I don't understand the problem. How do you fill in the gaps in "Y M"?

QSense
Creator II
Creator II
Author

Let me aunderstand. 

Actually for each id I have 12 months, but some id's months are missing like example. there is no problem if there is all months. In missing months Problem occurs.  In below example, in 202006 on hand value must be 29 not -1.

IDY Minputoutputon hand
12020025830
12020061229
120200710930
12020083429
lorenzoconforti
Specialist II
Specialist II

A couple of questions:

- do you add the missing month in another table (e.g. calendar) or they are coming from other ID's?

- it's your plan to fill the missing months from a script perspective (i.e. generating the missing months and filling them in with the previous on hand value) or just in a chart (i.e. only when displaying the information)?