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: 
marcel_olmo
Partner Ambassador
Partner Ambassador

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
rubenmarin

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

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

anbu1984
Master III
Master III

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 ];