Here in Slovakia, we have some products types that are taxed differently from other products. For example electornic 20%, medical accessories 10%.
On the product I have configured that product X has 20% and product Y has 10%. (also reindexed, cleared / flushed cache, removed all directories like view_preprocessed,...)
Result is that, both products are calculated with 20%.
Tax calculation is set based on shipping origin, which is configured.
Here is similar question which has been not answered Magento 2 - Two different tax percentage for two different products in same region