Calculate remaining amount available to invest in power BI - powerbi

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
This was a lot of words, so I hope what I'm asking makes sense. Thanks

Related

Why does powerbi average/day calculation become inaccurate over longer timespan?

I am trying to create a power BI calculation as an average per day of how many times a code was tripped. The dax calculcation that I have
Count Trips average per Day =
AVERAGEX(
KEEPFILTERS(VALUES('ruledata (2)'[Date].[Day])),
CALCULATE([Count Trips])
)
works fine when the average is being calculated over a couple days. I double checked this by hand and can confirm that it is accurate until at least 2 weeks. However once the time range increases to include months the average starts getting ridiculous and begins displaying average trips /day values that are much higher than the highest number of trips on a single day. I have confirmed that the data in the graph is correct
So I know that the values should reflect what is in the graph. In this two month example the DAX formula calculated the average to be 149.03 but the actual average/day should have been 82.8.
In general is there some sort of error in the DAX formula that I am using that could cause this?
I guess that 'ruledata (2)'[Date].[Day] is the day of the month. So if you take the average it will be wrong because when you take the average of e.g. March and April you will divide the total trips by 31, and not by 61 (30+31). So use 'ruledata (2)'[Date].[Date] instead.

How to add the total of a measure every across a range of date?

EDIT: I added additional information and context in a new post here.
I am trying to figure out what life after pandemic looks like for my firm.
We are currently operating at about 20% capacity for shipping orders. It is expected that those orders will return after the pandemic subsides.
I have a measure that calculates 80% of our backlogged orders. How to add it to the remaining dates of the year in my model? I assume I need to somehow strip the date context and then parse the total out amongst the remaining days...but I don't have the slightest idea how to begin doing that.
I'd like my total to be spread evenly over the next 4 months. Spearing it evenly by an upper limit works, too.
Any ideas?

Count number of records totalling a given percentage of the overall total in Power BI

I'm relatively new to power bi so please bear with me!
I have a report which looks at information about individual stores of a given customer.
One of the requirements is to show the % that the top N stores constitute to the overall total, for example the top 1 store makes up 30% of overall sales, top 5 stores make up 65% of the overall total, etc. I can achieve this easily using the 'Top N' filter function.
The other requirement is to count the number of stores which total 80% of the overall total sales. For example, we have a total of 100 stores for a given account which generate a revenue of £10,000. The top 60 stores generate a revenue of £8,000, therefore 60 of the 100 stores make up 80% of the overall sales.
Hopefully that makes sense! Is this possible within power bi? If so could someone point me in the right direction?
Thanks in advance for your help.

Open Office find all bills labelled POWER and work average cost

So I have made a spreedsheet to help me keep track of my power and gas bill - well the total cost of the bill anyway. This way as the months go on I am able to see what the average Power and Gas bill have been.
I am using only sheet1 and prefer to do it this way, so when I show my partner they don't need to flick through pages of numbers. It's right in front of them with Power & Gas in the next row - take a look at the image below.
So as you can see from the above (not including the J3 row) I have everything laid out in the layout I would like. This way when I get a bill emailed to me I add it, and then I can pay X amount and record that.
I know how to do =sum() and =average() but how can I limit it to only the power rows automatically.
The query should be looking up G column for power or gas and then whichever one it is get the H column next to it and then work out the cost per month by looking at the date the bill came out.
Power bill is every month so that easy, gas is every 3 months.
I know in open office they have the =if() command and I made it return TRUE when it was power but it does not seem that i can use just that function? I am wondering if maybe a TUT or example that outlines how we get the result like this.
Another example would be replace gas and power with tech toys i.e batteries over a year what was the real cost per monthly.
Ok after thinking outside the square - the answer I am using is this.
=AVERAGEIF(G3:G100;"POWER";H3:H100)/COUNTIF(G3:G100;"POWER")
I divided power by it's count as we get it every month
=AVERAGEIF(G3:G100;"GAS";H3:H100)/COUNTIF(G3:G100;"GAS")/3
I divided gas by 3 as we get it every 3rd month

Maximum profit array c++ multiple sell

Given an array of size n which represents prices of an object over n days . Each day you have to either buy a single object or you can sell any amount of objects you have to earn money.Assume that you can always buy an object. And you can sell only if you have some objects. So to maximize the total profit you have to choose particular day for selling and buying.
For example ..N=10 arr={5,0,9,2,9,0,2,7,4,7}, Now lets say initially total no of objects you have is n=0; and total profit p= 0
On day 1 you don't have any object so in any case you have to buy one ..
n=1 , p=-5 and now on day 2 you can buy second one with no amount to spend so n=2 and p=-5 on day 3 you can sell both objects and earn money so n=0 and p=13
similarly we can proceed further and maximum profit earned will be 35
Please help me with this question. I have already seen the problems where we have to choose the days to sell and buy ..but that seem to help me because here you have to either buy or sell each day ..Please give me some idea how to proceed
If you were to keep an average of the price, you could always buy when its below average, and sell when its above average.
You would have to keep a total of each day's price, so 5 for day one and two, 14 for day three and so on.
Then divide it by the number of days passed so far, so 14/3 = 4.66
if the day is greater than the average and you have objects, sell. Otherwise, buy.
Hope that helps!