Currently, I am trying to write a backend program to find out the Employer Contribution amount based on the salary of the employee.
However, the amount is not calculated by percentage but it's a fixed amount and there are at least a thousand possibilities.
For example,
wages > $800 and wages < $900
contribution amount is $1.70
wages > $900 and wages < $1000
contribution amount is $1.90
wages > $1000 and wages < $1100
contribution amount is $2.00
Since the amount is not based on a formula, I thought the solution is to use a lot of conditions but with this many possibilities, I'm afraid the server will be having a huge load and lag. Is there any advice on this problem?
If your concern is the server - just do the big if. No amount of business logic of this type can be a challenge for the server, even if it runs on a 20 years old hardware. Really. Reading a single character from the network connection will take more resources than going through a thousand if branches.
Related
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
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?
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
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!
I am using AWS calculator - http://calculator.s3.amazonaws.com/index.html.
When I chose reserve instances, in the estimate of monthly bill tab, I get "Total One-Time Payment" value.
Suppose, I have 3 servers cost to calculate. If I calculate the monthly cost of 3 servers and each server considered with 1 yr heavy reserve instance, then what the "Total One-Time Payment" value implies?
Whether that value is complete year upfront cost or 1 year upfront cost divided by 12?
Please help me understand.
Regards,
Chandan
It is the complete year upfront cost, meaning that you pay that amount only once at the beginning. After that you only pay for the compute time each month (the amount on the row labeled "Compute:").