The ledgers concerned by the budget calculation must necessarily have active "Analytical" and "Budget" flags (the budget can only be accessed if the "Analytical" flag is checked).