Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fill in missing records on load

Hello All,

I have a data table that I would like to upload into my qlikview app but I would like to fill in the missing MonthYear data with the next available Price and if their is no Next record then use the Last available record.  I have put an example of the RawData and an example of what the data should look like after it is loaded.  I want to start the data as of Today and create 12 MonthYear data points for each product.  My initial thought is to loop through the record set but I am having trouble figuring it out.

I really appreciate any help on this.  Thanks in advance.

RawData

productMonthYearPrice
abcMar-126.975
abcJun-126.5572
abcJul-126.456
abcAug-126.5056
abcNov-126.556
abcJan-137
xyzMar-1220
xyzJun-1221
xyzJul-1222
xyzAug-1223
xyzNov-1224
xyzJan-1325

UploadedData

productMonthYearPrice
abcJan-126.975
abcFeb-126.975
abcMar-126.975
abcApr-126.5572
abcMay-126.5572
abcJun-126.5572
abcJul-126.456
abcAug-126.5056
abcSep-126.556
abcOct-126.556
abcNov-126.556
abcDec-127
xyzJan-1220
xyzFeb-1220
xyzMar-1220
xyzApr-1221
xyzMay-1221
xyzJun-1221
xyzJul-1222
xyzAug-1223
xyzSep-1224
xyzOct-1224
xyzNov-1224
xyzDec-1225
1 Solution

Accepted Solutions
sridhar240784
Creator III
Creator III

ha.., Just noticed, small change in Price_Final_YearEnd field calculation.

Your expression should be as follows.

if(product = previous(product) and Len(Price_Final) = 0,peek('Price_Final_YearEnd'),Price_Final) as Price_Final_YearEnd

Check the attached application.

Hope this helps you again

-Sridhar

View solution in original post

13 Replies
sridhar240784
Creator III
Creator III

Hi,

Check the attached application.

Hope this helps you.

-Sridhar

Not applicable
Author

Thank you Sridhar I really appreciate your help.  I'm so sorry I made a mistake when copying my data over.  I corrected the mistake in the original post.   It seems that for MonthYear where the price is present the Price_Final is using the next price.  In this case if the price is present for a specific MonthYear it should use that price for the Price_Final.

Any idea how to fix this?

sridhar240784
Creator III
Creator III

Ok, i have check your o/p and designed this script. In your output table

for Product ABC --> Jun 2012 is using Jul 2012 Number and Jul 2012 is using Aug2012 Number and Nov2012 is using Jan 2013 num.

could pls confirm you o/p so that will change the script and post you soon.

-Sridhar

Not applicable
Author

Once again I appologize.  I corrected the o/p to display the proper end result.

sridhar240784
Creator III
Creator III

I have modified the script now.

Have a look at  the attched application now.

-Sridhar

Not applicable
Author

Thank you so much. Just one more question.  If I wanted to change to 36 months and use the last available price for those months how would I need to change the script? 

sridhar240784
Creator III
Creator III

if you want to add it at the front i.e. before Jan-2012 like Dec-2011, Nov2011. You may need to change the variable  which stores the minimum date for creating the master calander.

Let vMin = Num(Addmonths(YearStart(Peek('MinDate')),-23);

Hope this helps

-Sridhar

Not applicable
Author

No actually I would like it to always start with today and have the ability to change the months after to add more months like Jan2013, Feb2013... These extra records would need to use the last available price.

Hope this makes sense.  Thanks again.

Not applicable
Author

The idea is to be able to change the series for each product to display a term of any amount of months required.  It should not depend on the Min/Max MonthYear in the RawData.