Net Present Value With Discount Rate - sas

I'm trying to calculate net present value and payments of a 5,000 installment loan with a discount rate of 20%, an interest rate of 59% (simple annual), biweekly repayments for 3 years of payments. I need to know what the monthly payments will be, monthly interest, etc. and use those payments as the cash flows for NPV. I have started this but don't seem to be getting the right result, if it is correct, then problem solved but it seems off to me, I'm getting a little over $8,000 as the cumulated NPV (then if I add the negative principal due to the discounts and minus the starting principal balance I get around $1,500 net):
let's assume the fm2_bin_co_rate = 25% here:
data NPVBW;
set base_data;
rpmt_freq=26;
rate59=0.59/rpmt_freq; /*Interest rate*/
nper59=78; /*Number of periods: Term in installments*/
pv59=5000; /*Present value: loan amt * monthly charge off rate /2 for biweekly*/
pmt59 = FINANCE('pmt', rate59, nper59, pv59); /*Monthly payment*/
pb59=pv59; /*Principal Balance*/
do period59 = 1 to nper59;
ppmt59=FINANCE('ppmt', rate59, period59, nper59, pv59); /*Payment on the principal*/
mi59=pmt59- ppmt59; /*Payment on the interest*/
pb59=((pb59*(1-fm_bin_co_rate/nper59))+ppmt59)*(1-.014*(12/rpmt_freq)) /*early payoff rate*/;
npvrate59=1.2**(period59/rpmt_freq);
npvper59=pmt59/(1.2**(period59/rpmt_freq))/*discount rate*/*(1-fm_bin_co_rate/nper59)/*charge off rate over life of loan*/*(1-.014*(12/rpmt_freq)) /*early payoff rate per month*/;
output;
end;
run;

Related

Calculating dynamic cost from several tables

I'm new to Power BI and struggling a bit with concepts. My simplified problem is this:
I have a table with time-track data (possible multiple entries per day for the same user):
datetime
timeTracked (hours)
user
2022-12-01 14:15
1.5
john
2022-12-01 16:30
0.5
john
2022-12-02 12:00
2.5
tom
I also have second table with yearly wages for each user (irregular dates, wage is applicable from that day forward):
date
user
wage
2021-01-01
john
20000
2021-06-15
tom
25000
2022-02-01
john
22000
I want to somehow calculate the cost for a dynamic period or total time, but using other filters (like client).
For example: total cost for current month - the sum of hours for each user multiplied by hourly cost (let's say yearly wage / 1500 for simplicity). The complication is that there might be multiple applicable wages in the selected period.
I'm not sure if I should create a new table, new column(s) to existing table(s), measure(s) or anything else? I don't know how to deal with this problem in Power BI, any hints, links or examples are very appreciated!

DAX AVERAGE % SAVED IN A MATRIX FOR GROUP AND SUB-GROUP (ENTITY X USERS) Powerbi

I need the average % discount of a group of condominiums taking into account the following rule
Add the monthly average totals of discounts for each person, and divide by the total nr of months of all the people in the condominium, that is, if person A made transactions in 4 months, and B made it in 2 months, and C made it in 4 months, the total number of months is 10. So, to get the average, just take the accumulated total of the % saved and divide by these 10 months.
I have the correct average for people (sum of monthly averages, divided by the number of months), using the following DAX codes
Redução Tx do Usuário =
AVERAGEX(
KEEPFILTERS(VALUES('Dcalendario'[MesAno])),
CALCULATE([% ECONOMIZADO USUARIO])
)
where % user saved is the following DAX measure
% ECONOMIZADO USUARIO =
IF(
NOT(HASONEVALUE(clientes[Nome])),
AVERAGEX(
VALUES(clientes[Nome]),
[media economizado tx]
),
[media economizado tx]
where the average saved is the division of the penultimate column by the second, on 11.08.2021, the value is 0.10 divided by 325.00 = 0.10%
In the case of the image that I present to improve understanding, the % discount for Alcantara (condominium) is presented as 1.5%, when the correct one would be 1.12%
The total average of users, in this case, is 11.25%, divided by 10 months, which is the sum of the months in which transactions occurred by all users of this condominium, giving an average of 1.12%, the final objective is to have the average of each condominium and of the other condominiums that participate in the calculation, keeping the information of the average per user, and per month (both are already ok).
Value is wrong at condominium level
In this case, for the Alcantara calculation to be ok, I have to add the % of Aline + the % of Edevilson and 2 other people, which will total 11.25 and divide by 10 months (Aline's 4 months, Aline's 2 months Edevilson and 2 other people with 2 months each).
How should the DAX code be correct, so that the group total is ok, keeping the average number of people who are already ok?
And how can I get the total of these months (sum) to present on a card, I want the grand total of months of all transactions (sum of the months of each user).

How to write Maxx dax function to get maximum value per each group

I am trying to get Max of fee rate for each stream. I want to get the result as desired max fee highligted in yellow as shown in the table below.
I tried this dax calculation:
Desired max fee = MAXX(VALUES('Session Budget Tracker'[Stream]),CALCULATE(MAX('Session Budget Tracker'[Session Fee ($)]),ALLEXCEPT('Session Budget Tracker','Session Budget Tracker'[Stream])))
Can anyone help me to get the correct values please?
You can use calculate as shown below. it is taking the max based on each stream.
Desired max fee =
var progStream = 'Session Budget Tracker'[Stream])
return CALCULATE(MAX('Session Budget Tracker'[Session Fee ($)]), FILTER('Session Budget Tracker','Session Budget Tracker'[Stream] = progStream))

odoo tax calculation is not correct

I created a supplier invoice whose amount without taxes = 5125,000.
In my country we add a tax of 1% on the total amount of the invoice without taxes so 5125,000 + 1% = 5176,25 then we add the taxes on the products which is in this case 19% for all products 5176 , 250 + 19% = 6159.7375
. Finally I add a stamp tax of amount 0,600 of or the total equal to 6160,338
So my problem is I noticed that when calculating the amount of the tax 19% there is an error odoo gives the result of 5176,250 + 19% = 6159,746 where the final result of my invoice is different from the actual result it gives me a total equal to 6160,346
How can I solve this problem? Any help please ?

Buyers Premium Excel Calculation

I have this deadline in the next few hours and I would really appreciate your help.
I need to create a formula to calculate buyer premium fees from the hammer price at an auction.
It works like this.
The hammer price is = X
Tax1 £0-£100,000 = 25% (Every sale is charged 25% up to the value of £100,000 so max is £125,000 for this part)
Tax2 £100,000-£2,000,000 = 20% If the hammer price exceeds £100,000, then 20% is added for this portion.
Tax3 £2,000,000+ = 12%. If the hammer price exceeds £2,000,000, then 12% is added to this portion.
Could anyone help me create a formula that would allow me to enter the hammer price and it would auto-calculate the total fees and give me the total price including those 3 taxes.
The code I have so far is this:
Tax 1 = IF(B3<=100000,B3*0.25,100000*1.25)
Tax 2 = IF(B3<1900000,B3*0.2,1900000*0.2)
Tax 3 = (B3-2000000)*0.12
You can use simple if statement for the same
Please refer to the formula in the address bar below.
Breaking this down into smaller chunks
Cost less than 100k, 25%, otherwise 25% of 100k
=IF(A1<10000,A1*0.25,25000)
Cost over 100k but less than 2m, 20% of the portion between 100k and 2m + the 25% of 100k
+IF(AND(A1<2000000,A1>=100000),(A1-100000)*0.2,(IF(A1<100000,0,40000)))
Cost over 2m, 12% of the portion over 2m plus the previous chunks+IF(A1>2000000,(A1-2000000)*0.12,(IF(A1<2000000,0,65000)))
Putting it all together
=IF(A1<10000,A1*0.25,25000)+IF(AND(A1<2000000,A1>=100000),(A1-100000)*0.2,(IF(A1<100000,0,40000)))+IF(A1>2000000,(A1-2000000)*0.12,(IF(A1<2000000,0,65000)))
Few test cases
* Hammer Commission
* 0 0
* 10 2.5
* 100000 25000
* 100001 25000.2
* 2000000 130000
you can try this one which conforms to your conditions:
=IF(B3<=100000,B3*0.25,IF(AND(B3>100000,B3<=2000000),B3*0.2,IF(B3>2000000,B3*0.12,"NOT FOUND")))
Please confirm if below calculation for hammer price £500,000 are correct.
See below screenshot for functions used:
I'm still trying to share excel file with you. Can't upload here!!!
Excel file with required functions. See instructions to change Hammer Price in file.
Hammer Price Excel File