DAX formula for Time - powerbi

Time formula in Power BI
What I am trying to do:
If any train departed >= 59 sec, then "1", or else "0".
The formula I am using:
=if([Actual-Planned]>=time(00,00,59),"0","1")
This is partially working. It does give me "0" in the case where actual-planned time is 59 seconds, whereas per formula it should give me "1".
It works when I put it as (00,04,59) but does not work for seconds.
Has anyone come across this issue before?

right so this is my formula:
=if([Actual-Planned]<=time(00,00,59),"RTSF","RTSA"), which means if any time a train is less than or equal to 59 seconds it will achived Right time start or else fail, i guess i am getting the output now, as i changed to smaller than or equal to instead of greater. Thanks for your help

Related

Calculating weighted weekly average

I´m trying to calculate the weekly average of a certain value but I don´t know how Power BI is running to output what I get.
This is the table with the relevant raw data:
And this is what I´m getting:
For the week "6-OCT-12-OCT", the expected average should be 2.3% instead of the -28.29% shown.
Please, notice the value 1 is calculated as a "new measure". Could someone please tell me what is going on and how can it be properly done?
Thanks in advance!

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.

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.

Leave calculation mistake odoo

Hi i want to calculate half day leave for an employee. when applying for leave, the duration is set as 1/05/2018 18:30 -1/05/2018 23:30. ie 1.00pm to 6.00pm (ist).the day's calculation shows as 0.5 days. Working hour is scheduled as 9.00-18.00. But when generating payslip for the same employee total working days is shown as 31 days and working hours as 279. Odoo does not calculate the half day leave. how can i fix this? i have a doubt about specifying the time in duration while applying for leave. is it should be converted to utc?

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)