# CASE: create different variables depending on fiscal year / income yearvariab

If you want some calculation in your template with variables that have a different value for each fiscal year (or something else like the income year), you can create such variables and make use of the case-statement:

``````{% comment %}create variable that displays the fiscal year{% endcomment %}
{% assign fy = period.fiscal_year %}

{% comment %}by a case-statement we'll create certain variables depending on the fiscal year{% endcomment %}
{% case fy %}
{% when 2017 %}
{% assign tax_perc = 0.25 %}
{% assign tax = "25%" %}
{% when 2018 %}
{% assign tax_perc = 0.27 %}
{% assign tax = "27%" %}
{% else %}
{% comment %}the else-statement is used to make sure the template can be used even new percentages haven't been released yet{% endcomment %}
{% assign tax_perc = 0.27 %}
{% assign tax = "27%" %}
{% endcase %}

{% ic %}
{::infotext}
{% t "The percentages, if not published yet, will take the last know published ones" %}
{:/infotext}
{% endic %}

{% assign profits = -(#60__68+#70__78) %}

<br>

{% comment %}show calculation on when there's actually profits{% endcomment %}
{% if profits > 0 %}
{% t "Calculation tax" %} = {{ profits | currency }} x {{ tax }} = {{ profits*tax_perc | currency }}
{% else %}
{::infotext as="hover"}
{% t "No profits have been made during the year" %}
{:/infotext}
{% endif %}
``````

So this assigns the fiscal year into the variable `fy` : `{% assign fy = period.fiscal_year %}`

Then, with the case-statement, you’ll create variables but assigns it to the correct value depending on the case (fiscal year) it is:

``````{% case fy %}
{% when 2017 %}
{% assign tax_perc = 0.25 %}
{% assign tax = "25%" %}
{% when 2018 %}
{% assign tax_perc = 0.27 %}
{% assign tax = "27%" %}
{% else %}
{% comment %}the else-statement is used to make sure the template can be used even new percentages haven't been released yet{% endcomment %}
{% assign tax_perc = 0.27 %}
{% assign tax = "27%" %}
{% endcase %}
``````

You could also create a variable depending on the income year perhaps:

``````{% assign income_year = period.year_end_date | date:"%Y" %}
``````

The variable `income_year` is a string-value, so you’ll need to adapt that in your case-statement and call upon that string-value with double quotes:

``````{% case income_year %}
{% when "2015" %}
{% assign tax_perc = 0.25 %}
{% assign tax = "25%" %}
{% when "2016" %}
{% assign tax_perc = 0.27 %}
{% assign tax = "27%" %}
{% else %}
{% comment %}the else-statement is used to make sure the template can be used even new percentages haven't been released yet{% endcomment %}
{% assign tax_perc = 0.45 %}
{% assign tax = "45%" %}
{% endcase %}
``````

Output:

or