Hello!
I have a data where there is a budget set for each product (yearly budget), and also the costs of the product per month. For the first month, the budget is yearly_budget/12, for the next month it’s yearly_budget-costs_1st_month/11, for the next one it’s yearly_budget-(costs_1st_month+costs_2nd_month)/10 and etc, i.e. each month budget is recalculated.
I’ve created a caulculated filed for an adjusted budget and if we look into the table, the data is correct.
What I want to achive is to have a combo chart where bars are product costs, and line is the adjusted budget. When I have the following setup it’s saying that calculation reference is missing in the fields
But when I swap costs and adjusted budget, it then shows it properly
Is it possible to achive the first case, where costs are bars and adjusted budget is a line?
Formula for adjusted budget
ifelse(
isNull({running_costs}),
avg({yearly_budget})/12,
(avg({yearly_budget})-{running_costs})/(avg(13-{pt_month}))
)
Formula for running_costs
lag(
runningSum(sum(costs), [{pt_month} ASC], [{md_product_name}]),
[{pt_month} ASC],
1,
[{md_product_name}]
)
Best regards,
Kseniya


