Template is not showing all selected accounts

Hi @bartanthonissen and welcome to the Community!

Mapping lists are period specific, so changing the mapping list can have some consequences indeed. We actually recently uploaded a case, that I think reflects the issue you are currently facing:

The solution offered in this case will only work for templates that compare year end values.
If your template is also used in periods that are not necessarily the year end, the possible solution would be a bit more elaborate.

Can you try if looking at the opening value solves the issue at hand?
In your code it could look like this:

{% assign acc_nbr = acc.mapped_number %}
{% assign acc_selected = period.accounts | range:acc_nbr %}
{% assign acc_py_value = acc_selected.opening_value %}

kind regards
Romy