buy a product from X category and buy a product from Y category and get 15% off on the total price of two products, How to set up this?
15% should apply only to the total price of two products, not on the entire cart.
Admin panel -> Marketing -> Cart Price Rules
Admin panel -> Marketing -> Catalog Price Rules
Here you can add new rules for your products and add conditions for discounts.
The following link (although being Magento 1.x) may get you on the right tracks: