Skip to main content

With the help of a number of posts on the forums, I've taken a large dataset and been able to evaluate the total time, within a range of days, pool cars have been used. What I'm now struggling with is to calculate the hours used as a percentage of a "working day"

eg;

Car One used for 04:20:00 hours, what percentage use is this against a working day of 07:00:00?

 

Do I need to calculate this out in seconds and convert back or is there another way?

 

Thank you.

I wrote out the calculation for you ( as I could not find a transformer to do so).

Was not too hard.

Hope this helps.


Pretty much whatever the solution, it would end up being converted to seconds somewhere along the way.

Try to create a new attribute with the following formula in the arithmetic editor (substituting "usage" and "workday" with your own attribute names of course):

@DateTimeParse("@Value(usage)",%H:%M:%S)*100.0/@DateTimeParse("@Value(workday)",%H:%M:%S)

With your example it returns 60.


@erik_jan & @david_r , thank you both for the replies. I did work through a solution after posting this morning, but will try both your answers. (I'm a complete FME newbie but love what it does).

 

I'm now looking at taking results from another dataset in order to add them to this data.

 

 

I shall post a grab of what I put together.

I put a solution in the Question of the Week thread.

Basically a DateTimeCalculator should do most of what you need by simply assuming the work day runs on 000000 to 070000:


Reply