I want to make a subtotal of values corresponding to the same tax code in Netsuite Advanced PDF/HTML. Is it even possible? What are other ways to achieve my goal?
This is definitely possible. The templating engine that Netsuite uses under the hood is Apache FreeMarker, and I would highly recommend looking at the documentation there for a full details.
Here is some basic untested code that you can use to start:
<#assign tax1subtotal = 0 >
<#assign tax2subtotal = 0 >
<#assign tax3subtotal = 0 >
<#list record.item as item>
<#if item.taxcode == [taxcode1]>
<#assign tax1subtotal = tax1subtotal + item.tax1amt>
</#if>
<#if item.taxcode == [taxcode2]>
<#assign tax2subtotal = tax2subtotal + item.tax1amt>
</#if>
<#if item.taxcode == [taxcode3]>
<#assign tax3subtotal = tax3subtotal + item.tax1amt>
</#if>
</#list>
Tax Type 1 Subtotal: ${tax1subtotal}<br/>
Tax Type 2 Subtotal: ${tax2subtotal}<br/>
Tax Type 3 Subtotal: ${tax3subtotal}<br/>