SharePoint calculated column with 3 conditions - if-statement

I have a SharePoint list like:
SharePoint List
"All Hours per Shift" are calculated from =IF([Time Out]="","0",TEXT([Time Out]-[Time In],"h")).
Then breaks need to be deducted.
My "Hours per Shift" are calculated from "All Hours per Shift" with formula like:
=IF([All Hours per Shift]<4,[All Hours per Shift],IF(AND([All Hours per Shift]>4,[All Hours per Shift]<11.9),[All Hours per Shift]-0.5,IF([All Hours per Shift]>11.9,[All Hours per Shift]-1.5)))
I need:
AllHoursPS <4 do nothing
AllHoursPS >4 and <11.9 then -0.5h
AllHoursPS > 11.9 then -1.5h
Both columns, "All Hours per Shift" and "Hours per Shift" are Numeric columns with 1 decimal place.
Unfortunately, the formula always deducts 1.5h. Why?
Could someone help, please?
Thank you.
Slawek

What's the type of the column "All Hours per Shift"?
Assuming it's a number column, you could use this formula:
=IF(value([All Hours per Shift])<4,[All Hours per Shift],IF(AND(value([All Hours per Shift])>4, value([All Hours per Shift])<11.9),[All Hours per Shift]-0.5,IF(value([All Hours per Shift])>11.9, [All Hours per Shift]-1.5)))

Related

PowerBI: Calculating Margin net of Labour

I am new to Powerbi and needed some help on creating a dax calculation.
Objective: calculate the margin net of labour costs.
I already have a table that contains the margin$(price - cost).
Regarding labour info:
the fixed wage rate is $17.00
During the week the number of hours worked is 9/ per weekday
on saturday the number of hours worked is 8
on sunday the number of hours worked is 6
I want to create a function that tells me the labour cost for a given day and overall labour cost should sum as each day passes.
I figured I should create specific variables in DAX but following that is were I am confused.
How do I dictate to powerbi the hours and rate to apply? any guidance?
|rate:17.00|
|weekdayhours: 9|
|sathours: 8|
|sunhours: 6|

Creating new calculation to sum a Dax Calculated Measure in Power BI

I have a promised hours calculation that looks at two dates (Coalesce) and gets the number of weeks in the month and then multiply it by the max promised hours for an employee which has a row for every week of the month. The employee could have 5 rows for every entry a week and the promised hours shows up the same as for example 40 for that week, thus why I have to take the max instead of do a sum. But at the end I need to show the total number of promised hours per week for whatever timeframe is chosen in the date slicer per employee.
Promised Hours Calc = CALCULATE(WEEKNUM(Max([CoalesceActualStart_AbsenceStart]),1)-WEEKNUM(MIN([CoalesceActualStart_AbsenceStart]),1))*MAX(FSLData[PromisedHours])
I then need it to do a sum for every employee on the above calculation.
I am getting all sorts of errors trying to do a sum on the calculation as a whole.
What you write is confusing and incomprehensible. That's why you get the errors. As soon as you are able to formulate your problem in such a way that others can understand it, you will understand it yourself and the errors will go away.

Calculate Daily Average Month To Date in PowerBI

In Power Bi my average matters per day is not stopping on the current day.
Avg Per Day = DIVIDE([Matters],SUM(Dates[IsWorkday]))
where IsWorkday = IF(ISBLANK(Dates[Holiday]),IF(Dates[DayOfWeekNumber]>1&&Dates[DayOfWeekNumber]<7,1,0),0)
and Matters = COUNT(BillingData[Item])
So today is the 27th of the month so 18 of 20 work days are completed for the
month. So need [matters]/18, not [matters]/20.
How do I factor that in to my average and not affect previous months.
Any help appreciated.
Sounds like you need to just add one more condition to your if statement to add in that the date is less than todays date. Check out this post. I think it might have the solution to your problem or at least give you the idea you need to solve the issue.
https://community.powerbi.com/t5/Desktop/Networkdays-DAX-function/td-p/38044

How to calculate number of hours when hours per day changed during the course of the project in Python 2.7 Django-admin

For example, I have to input hours per day and yesterday it was 4.0 then I want to change it to 6.0 today. How can I calculate the total number of hours, retaining the previous hours and adding it to the new hours, in a given date range?

IF Formula HELP. Nesting

I need help with a formula..The situation is..
Daily rate for painting is:
$100 per day for 3 or less days of painting
$90 for each day beyond the first 3.
For example, if you paint for 5.5 days, you get paid $100 for each of the first three days and $90 for each of the remaining 2.5 days giving a total of $525.
How can I put this as a IF formula?
I don't think that needs an IF at all. You could do this:
=MAX(0,(A1-3))*90+(MIN(3,A1)*100)
Subtract 3 from the value in A1. Any result greater than zero you will be multiplied by 90. Any result less than zero will be ignored. Then work out what is smaller: A1 or 3. Whichever is the smallest will be multiplied by 100.
assuming the days is in column A
IF(A1>3, 300+(A1-3)*90, A1*100)