Calculation with template sensor

I’m trying to do a ROI calculation with a template sensor. But somehow I don’t get it working, and I expect it is something small…

{{((8000 / ((states.sensor.thuisbatterij_total | int) / (states.sensor.aantal_dagen_batterij_operationeel | int )) /365 | int )) }}

What I am trying to do:
Investment is 8000
sensor.thuisbatterij_total is the profit in total - current value approx 400
Sensor.aantal_dagen_batterij_operationeel is the number of days operational - current value 129
This deciding by 365 days a year

So I expect a result of 7. But it doesn’t give any result, nor a failure
What am I missing?

With the numbers you gave and the template you attempted:

8000/400/129/365 = 0.000424

Also the correct syntax is:

{{ 8000 / ( states('sensor.thuisbatterij_total') | int / states('sensor.aantal_dagen_batterij_operationeel') | int ) / 365 }}

8000/(400/129)/365 = 7.1

As Tom pointed out you aren’t using the correct method to get the state value.

Make sure you are using your parentheses correctly to get the right order of operations:

{{ ( 8000 / ( states('sensor.thuisbatterij_total') | int / 
states('sensor.aantal_dagen_batterij_operationeel') | int ) ) / 365 }}

Or, you can use set statements to break it up:

{% set a =  states('sensor.thuisbatterij_total') | int / states('sensor.aantal_dagen_batterij_operationeel') | int  %}
{% set b =  8000 / a %} 
{{ b / 365 }}