Hi @Rus welcome to the community.
The high-level steps involve, creating two variables with the appropriate filters using “if else” (similar to click here). Then, perform the calculations based on this video.
In case you need further assistance with your problem, please create a sample dashboard with sample dataset showing your problem state using Arena and post it here. (Details on using Arena can be found here - QuickSight Arena
Please let us know if this is helpful.
Alex