# CASE: use the at_least and at_most filter

Let’s say we want to calculate a tax credit of 10% on the positive difference between investments and loans, with a maximum amount of 1,000.

There are some investments and loans done over a period of 2 years and we calculate a 10% tax credit on the difference between the investments and loans.

``````{% assign tax_credit_rate = 0.1 %}
{% assign max_tax_credit = 1000 %}

{% assign loans_y1 = 20000 %}
{% assign loans_y2 = 15000 %}

{% assign difference_y1 = investments_y1-loans_y1 %}
{% assign difference_y2 = investments_y2-loans_y2 %}

{% assign tax_credit_y1 = difference_y1*tax_credit_rate %}
{% assign tax_credit_y2 = difference_y2*tax_credit_rate %}
``````

Without application of the at_least and at_most filters, the tax credit would be displayed as followed:

We want to display the difference as zero if it would be negative:

``````Difference year 1: {{ difference_y1 | at_least:0 | currency }}
Difference year 2: {{ difference_y2 | at_least:0 | currency }}
``````

This leads to the following result: Now we want to display the tax credit that was calculated. The tax credit can’t be negative and is limited to the maximum amount of 1,000 that was defined earlier.

``````Tax credit year 1: {{ tax_credit_y1 | at_least:0 | at_most:max_tax_credit | currency }}
Tax credit year 2: {{ tax_credit_y2 | at_least:0 | at_most:max_tax_credit | currency }}
``````

Output: 