Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dividing budget over weeks

I have a table with a budget per product for the whole year, another table with the % of budget for a particular week. The percentage table is read using a crosstable, no issues sofar

To put the 2 together, I want to end up with per product 52 weeks with the divided budget.

What is the way to solve this ?

Labels (1)
3 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

do you have a datefiled in budgettable? If yes, enter this function:

Week(Datefield) As Week

The name of the new field must be the same as the name of your Percentagetable.

If you want to use this tables over years, you must use the function

Weekname(...) because now the field will look like this: 2011/01

suniljain
Master
Master

you will get weekly budget by following formula.

=total_budget /((week( Weekend(Date))- week( Weekstart(Date)))

johnw
Champion III
Champion III

OK, so you have this?

YearlyProductBudgets:
year,product,budget

WeeklyProductBudgets:
year,week,product,percent

If you just want to do the calculation in a chart with year, week and product as dimensions:

budget * percent

For other combinations of dimensions, you may need to aggregate manually.

aggr(budget * percent,year,week,product)

But I suppose it'll be better to just allocate the budget in the script.

LEFT JOIN (WeeklyProductBudgets)
LOAD *
RESIDENT YearlyProductBudgets
;
LEFT JOIN (WeeklyProductBudgets)
LOAD *
,budget * percent as weekbudget
RESIDENT WeeklyProductBudgets
;
DROP TABLE YearlyProductBudgets;
DROP FIELDS
budget
,percent
;
RENAME FIELD weekbudget TO budget;