Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Populate missing months

Hi All,

I have a table with data like below,  in the table for the unit 7511 I am not getting some of the months data because of I didn't have sales for that unit on the messing month. however I would like to show ,unit number, missing month,  '0' in the Sold column how do I get this, can any one help me on this.

Actual:  

   

UnitMonthActual
7511Sep 2014139232
7511Nov 201417023
7511Dec 20147177
7511Jan 20156827
7511Feb 20152738
7511Mar 201513245
7511Apr 201512523
7511Jun 201520164
7511Jul 20155890
7511Aug 20155071
7511Sep 201511891
7511Oct 20152757
7511Nov 20157036
7511Dec 20154195
7511Jan 20166372

Expected

   

UnitMonthActual
7511Sep 2014139232
7511Oct 20140
7511Nov 201417023
7511Dec 20147177
7511Jan 20156827
7511Feb 20152738
7511Mar 201513245
7511Apr 201512523
7511May 20150
7511Jun 201520164
7511Jul 20155890
7511Aug 20155071
7511Sep 201511891
7511Oct 20152757
7511Nov 20157036
7511Dec 20154195
7511Jan 20166372
19 Replies
Not applicable
Author

Pradeep sorry for my mistake , I have attached wrong test data earlier , please find the correct file above.

PradeepReddy
Specialist II
Specialist II

see the attachment...

I have restricted the data for 3 units only(7511, 7512, 7513), bcz of size issue. you can remove the condition in script..

Not applicable
Author

thank you so much Pradeep taniparthy , could you please explain me the concept behind entire logic that you have written.

PradeepReddy
Specialist II
Specialist II

is this the expected result?

Not applicable
Author

Yes you saved my time. , that is exactly what I want.

please explain me the script that you have written,i a, curious about the  last iterno()  section what is happening there?

PradeepReddy
Specialist II
Specialist II

Glad to help..

I am Calculating the no.days between the two sale dates of same Unit. (Jan-01-2015, Jan-03-2015 =2)

After that I am  generating the missing dates between those 2 dates, by using loop.The loop will be iterated till 'no.of Days' calculated for each sale date entry

For 1st Iteration (Jan-03-2015)-1+1 --> Jan-3-2015

For 2nd Iteration (Jan-03-2015)-2+1 --> Jan-2-2015

For Accumulated values, I have used the Peek() function..

Not applicable
Author

Thank you so much.

Not applicable
Author

Pradeep I have followed the script procedure you have provided , however I am getting

General Script Error

Execution Failed      after Iteration, to pick previous Accumulated value .

sunny_talwar

Can you share your script?

PradeepReddy
Specialist II
Specialist II

can u share your QVW?