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

generating missing months with zero sales for full year

I have a requirement to generate records for missing months. The missing records should be populated  with 0 Sales.

The link - generating missing months is very similar to what I need but I couldn't figure out how to use iterno() for my situation. I need to fill the amount for the full Year. Eg:

Source Data:

 

AcntMonthSales
A1Jan56
A1Feb48
A1Nov49
A2Jan45
A2Feb34
A2Mar23
A2Apr32
A2May46
A2Jun78
A2Jul35
A2Aug54
A2Sep97
A2Oct66
A2Nov77
A2Dec88
A2Jan70

This is how  my resulting data set should look like:

 

AcntMonthSales
A1Jan56
A1Feb48
A1Nov49
A1Mar0
A1Apr0
A1May0
A1Jun0
A1Jul0
A1Aug0
A1Sep0
A1Oct0
A1Dec0
A2Jan45
A2Feb34
A2Mar23
A2Apr32
A2May46
A2Jun78
A2Jul35
A2Aug54
A2Sep97
A2Oct66
A2Nov77
A2Dec88
A2Jan70

Appreciate all your help.

Thanks

Samy

5 Replies
Anil_Babu_Samineni

Are you expecting in script / Front end?

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
Anonymous
Not applicable
Author

in the script,, thank you!

Anil_Babu_Samineni

Have you seen this?

Generating Missing Data In QlikView

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
Anonymous
Not applicable
Author

Hi

Used following script to generate Missing Month against its values.

Temp_Date_Range:

LOAD

num(Min(DATE("RegistrationDate"))) as MinDate,

num(Max(DATE("RegistrationDate"))) as MaxDate

Resident  SourceData_TB;

LET vMinDate=Peek('MinDate',0,'Temp_Date_Range');

LET vMaxDate=Peek('MaxDate',0,'Temp_Date_Range'); 

drop table  Temp_Date_Range;

MasterCalender:

LOAD 

Date(Temp_Date) as "Key",

Year(Temp_Date) as Year,

Month(Temp_Date) as Month;

LOAD DISTINCT

  $(vMinDate) +IterNo()-1 as Temp_Date

  AutoGenerate(1)

  while IterNo()+$(vMinDate)-1<=$(vMaxDate);

Regards

Sahadev

Anil_Babu_Samineni

Can you share the QVW file where you working?

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