How to deal with transactions that can belong to multiple categories?

I'm working on an app where you can see transactions. Every transaction will be categorized (automatically). So far so good. The thing I run into now is how to deal with transactions that can (and maybe should) belong to multiple categories. For example car insurance. It would be logical to categorize it under "Car expenses", but also under "Insurances". I think it would be beneficial to actually see this transaction in both categories. The problem here though is that it is hard to calculate a total for every category if a transaction can belong to multiple categories; the total of the categories will not be equal to the total amount of the transactions. How would you approach this problem?

Thanks a lot in advance!