Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Partner
Partner

Distribution of numbers automatically

Hi guys,

I have a budget of get  100 new customers per year and I'd like to distribute the budget over the months.

A simply way would be divide 100/12 and write it one per month, but it wouldn't be nice, I'd prefer to assign natural numbers.

Something like this :

  

MonthCustomer Budget
ene9
feb9
mar9
abr9
may8
jun8
jul8
ago8
sep8
oct8
nov8
dic8
Total100

Regards, Marcel.

2 Replies

Re: Distribution of numbers automatically

Hi Marcel, you can adapt to your requirements this epxression:

Floor(100/12)+If(Month<=Mod(100,12), 1, 0)

Highlighted
anbu1984
Honored Contributor III

Re: Distribution of numbers automatically

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

Load *,If(IterNo() <= Rem, BudgetTemp + 1,BudgetTemp) As NewBudget,SubField('$(MonthNames)',';',IterNo()) As MthNm While IterNo() <= 12;

Load *,Floor(Budget/12) As BudgetTemp,Mod(Budget,12) As Rem Inline [

CustID,Budget

1,100

2,120 ];