Template value unknown

hi there any idea why the below code from the the template editor which works as expected does not work in a template sensor yaml file, i get unknown back

{{states('input_number.oiltankheight')|float(0) - 
(states('sensor.lvl_oiltank') |float(0)*1000)|round(1)/1.1 - 110
}}

yaml file

      oiltankvolulme:
       value_template: >-
        "{{(states('input_number.oiltankheight')|float(0) - (states('sensor.lvl_oiltank') |float(0)*1000) /1.1 - 110) |round(0)}}"
       value_template: >-
        {% set x = states('input_number.oiltankheight')|float(0) %}
        {% set y = states('sensor.lvl_oiltank') |float(0)*1000 %}
        {{ ( (x - y) / 1.1 - 110 ) | round(0) }}"

Hi nikito7 i appeciate the reply, strangley this worked for me after trying a few things. All i did was enter the string in one line which i do not undeerstand.

      oiltankvolulme:
       value_template: "{{(states('input_number.oiltankheight')|float(0) - (states('sensor.lvl_oiltank') |float(0)*1000) /1.1 - 110) |round(0)}}"

it appears ok

Don’t use quotes for multi line templates. So like this

oiltankvolulme:
       value_template: >
        {{(states('input_number.oiltankheight')|float(0) - (states('sensor.lvl_oiltank') |float(0)*1000) /1.1 - 110) |round(0)}}

Or like this:

oiltankvolulme:
       value_template: "{{(states('input_number.oiltankheight')|float(0) - (states('sensor.lvl_oiltank')|float(0)*1000) /1.1 - 110) |round(0)}}"

Thanks for the update btw.