(Excel) If cell is greater than <condition> then minus <number> - if-statement

I’m creating an excel spreadsheet that contains the following:
Cell B4: Number that represents Bob’s subcontractor fortnight (earning in 2 weeks) earnings.
Cell B6: Number that represents Bob’s student allowance a fortnight.
Cell B5: Display the the total that was subtracted from Bob’s student allowance this specific fortnight.
Subtraction of allowance: If bob earn more than $300 as subcontractor his allowance will be reduce by 0,60 cents in each dollar over $300 in his subcontractor earnings.
0,60 * (B4-300) = subtraction
Using Excel, what is the formula to calculate the remaining amount in Bob's student allowance?
I have tried the below, but it doesn't work.
IF B4>300-60% from B6

Okay, so..
The IF function to calculate B5 (amount to subtract from student allowance)
=IF(B4>300;0,6*(B4-300);0)
IF Bob earns more than $300 then multiplay 0.6 cents per euro above 300. Else, the subtraction equals $0.
Using Excel, what is the formula to calculate the remaining amount in Bob's student allowance?
=IF(B4>300;B6-0,6*(B4-300);0)

Related

Converting text million value into number - power bi

I did a few steps in Power BI. I have annual revenue column with high values as 600000000 and more..so I converted this column with number values into new column with million values:
I created new column annual revenue in millions using formula: AnnualRevenue(Millions) = format('Reporting HubSpotCompanyCurrentValueView'[annualrevenue], "#,0,,") so I got values like: 1, 10, 716 etc. but all these values are text values not number so my question here how is it possible to convert into numeric values? I need to numeric value as I want to create range based on annual revenue and count values in specific range. When I'm trying to convert new column with million values I got error that it's not possible. Anyone can help me?
annual revenue
annual_revenue(millions)
100000000
100
2879430000
2879,43
Note that you are using different terms for the same thing:
"annual revenue" vs. "annualrevenue"
"annual_revenue(millions)" vs. "AnnualRevenue(Millions)"
In Power BI this would cause problems.
To convert your annual revenue to a number of multiples of millions you could use either expression:
Annual Revenue (Millions) as Number = 'Table'[annual revenue] / 1e6
Annual Revenue (Millions) as Number = VALUE('Table'[annual_revenue(millions)])

How to calculate average win rate among all the student using DAX in PowerBI

Hi everyone,
I have a sample data as shown in the screenshot above. There are 3 students with different ID : student 123, student 234, student 456. The profit column in the table is how much they earn in each trade.
Winning trade = profit > 0
Losing trade = profit < 0
Based on the definition above for the winning trade and losing trade, I want to calculate the average winning rate for all the students.
Student 123 - the winning rate is 50% (2 negative profit and 2 positive profit)
Student 234 - the winning rate is 33.3% (2 negative profit and 1 positive profit)
Student 456 - the winning rate is 100% (0 negative profit and 2 positive profit)
So, the final answer, average winning rate among all the students is:
(50% + 33.3% + 100%)/3 = 61.1%
61.1% is the final output that I want, then I will put this value into a Donut chart. I'm relatively new to DAX, any help or advise will be greatly appreciated!
Please paste text rather than images when providing sample data.
You shouldn't really add averages together like that but if that is definitely what you want, use Measure 2.
If you want a more traditional average to be calculated, use Measure 1.
Measure 1 =
VAR total = CALCULATE( COUNTROWS('Table'), ALLEXCEPT('Table','Table'[Student]))
VAR pos = CALCULATE(COUNT('Table'[Profit]), ALLEXCEPT('Table','Table'[Student]),'Table'[Profit] > 0)
RETURN pos/total
Measure 2 =
VAR students = CALCULATE(DISTINCTCOUNT('Table'[Student]), ALLEXCEPT('Table','Table'[Student]))
RETURN SUMX(VALUES('Table'[Student]), [Measure 1]/students)

Power BI Measure - Checkbook balance column

Objective:
Looking to generate a column measure (DYNAMIC BALANCE) which reads the first row of BALANCE, and calculate the balance from subsequent rows using AMOUNT column.
Problems encountered:
Measure should ignore the AMOUNT on the first row and only capture the BALANCE into a variable.
My first row formula grabs both values for 1/1/2021 rather than only the top most row balance value.
Date
Description
AMOUNT
BALANCE
1/1/2021
Dog Food
-20.00
980.00
1/1/2021
McDonalds
-30.00
950.00
1/5/2021
Pay Day
1000.00
1950.00
1/8/2021
Dog Food
-20.00
1930.00
1/10/2021
Medical
-1000.00
930.00
1/18/2021
McDonalds
-30.00
900.00
1/21/2021
Pay Day
1000.00
1900.00
1/31/2021
Dog Food
-50.00
1850.00
2/2/2021
McDonalds
-40.00
1810.00
You are my hero!
Here is the solution. Funny how the solution is so simple in DAX and in hindsight. M-Code would have been more complicated. DAX is dynamic to the filter which is necessary.
New Measure:
RunningTotal = FIRSTNONBLANK(bankdownload[Balance],0)+SUM(bankdownload[Amount])-FIRSTNONBLANK(bankdownload[Amount],0)

How to aggregate non numerical values on power bi?

I have a matrix with numerical values assigned to securities ratings.
Let's say B- = 16 and B+ = 14, with both weighing 50% of the portfolio. In that case, the overall portfolio score would be 15 ((14 + 16)/2), which is assigned to a B rating.
How can I 'convert' back that 15 weighted average to a letter on the grand total?

calculate percentile for each entry in the data list

//I have a list of students List<Student>
Students
{
lond StudentId;
double Marks;
int Rank;
double Percentile;
}
I am supplied with Id and Marks, and need to calculate rank and percentile.
I searched on methods for calculating percentile but they provide answer in different format like - how to calculate 95th percentile or 5th percentile.
But what i need to calculate is rank and specially percentile for every student and not a specific percentile holder.
thnx in advance...
Okay, so you need to first rank/sort all the Students by Mark such that the best grade is the first in the list. Then you can populate the Rank obviously by just counting up.
For the percentile you take (TotalNumberOfStudents - Rank of Student) / (TotalNumberOfStudents - 1)
So in other words, if you are the top ranked student you are better than 100% of the other students and if you are ranked 50 out of a 100 students then you are better than 50% of the students.
Now one wrinkle is that if students can have the same exact grade then they need to not be counted in the Denominator of the formula since that represents the number of students worse than you.