I don't think this is possible (edit: you can manually implement it with filters, as shown in goliney answer ). The documentation says:
Because Django intentionally limits the amount of logical processing available in the template language, it is not possible to pass arguments to method calls accessible from within the templates. Data must be computed in views, then passed to templates for display.
If your case is not more complicated than what you are showing, the best solution in my opinion would be to bikeProfit .
{% for year, profit in bikeProfit.items %} ... <th>Total profit {{ year }}:</th> ... <th> {{ profit }} </th> ...
source share