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: 
alex59800
Contributor
Contributor

Generate month & year on customer data

Hello i try to find a way to create Missing months in my table below

Month and year come from invoice date but as i have no invoice for example in februray, so i have no line.

I would like all month to appear for one year as i need to allocate fix amount on each month (250€ as below)

Is there any way through script to generate those missing month (2,3...) ? (i tried to left join a calendar with autogenerate date but not working)

CustomerMonthTurnoverFix Amount to allocate on 12 months even if month does not appear (not invoiced)
04000318 605.56 €250
040003421 472.48 €250
04000356 426.90 €250
040003619 796.40 €250
0400037€ -556.80250
0400031013 568.70 €250
040003129 677.98 €250
040003Total78 991.22 €1750
4 Replies
NhanNguyen
Contributor III
Contributor III

Try this:
LOAD RowNo() as Month,
Turnover,
250 as FixAmount
Autogenerate(12);

Vegar
MVP
MVP

I assume you do not have a Total row in your data set (if you do you will have to handle it additionally)

First generate the fixed value transactions with a loop.

For each vCustomer in fieldvaluelist('Customer')
For vMonth = 1 to 12
Transactions:
Load
'$(vCustomer)' as Customer,
$(vMonth) as Month,
250 as [Fix Amount]
Autogenerate 1;
Next
Next


Then left load your dimensions and turnover values.
Left join (Transactions)
LOAD
Customer,
Month,
Turnover
From DataSource;

alex59800
Contributor
Contributor
Author

Hello hanNguyen
Autogenerate (12,1) is not understood as a correct syntax


Alexandre DAUCHY
Responsable Contrôle de gestion Groupe
Brunel Chimie Dérivés
Fixe : +33 3 20 43 24 12
Port : +33 6 74 11 93 09
Abrégé : 6168
P avant d'imprimer, pensez à l'environnement
Vegar
MVP
MVP

The Autogenerate parameter needs to be a single positive integer.

Please check your code. I notice that @hanNguyen uses Autogenerate(12) not Autogenerate(12,1)