'Calculate remaining amount available to invest in power BI

I am trying to create a table in Power BI that shows the remaining amount available to invest based on a 10% limit of total investments.

So for example, if we have 1,000,000 invested in 10 names, no name is allowed to be invested more than $100,000. What it looks like in excel is in the below image. it sumifs all the amounts that have days remaining >0 and then multiplies that amount by 10% to give us our 10% limit. It then sumifs each individual investment name for the total amount invested (A has 51,000,000 invested) and in the "remaining max allowed" subtracts that number from the 70,647,200 to show us how much more we can invest in that name

So far I have Created a measure that looks like this that gives me the amount invested with days remaining greater than 0, but I do not know how to then substract that number from 10% of the total amount of names invested with days remaining greater than 0 enter image description here

This was a lot of words, so I hope what I'm asking makes sense. Thanks

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source