{% set max = 0 %} {% for month in cashflow.months %} {% set max = max(max, month.income, month.expense) %} {% endfor %} {# ===================== CASHFLOW ===================== #}