Nov 01, 2023 05:49 AM
Good morning!
I am trying to determine how much I am making per hour at various markets that I vend.
I input my markets with a start date+time field and an end date time field and have that calculate out to a duration field.
I also have my earnings field (which is what I made minus event fees, also calculated out). *it's the "Minus Fees" column I'm using for my final calculations
Logically, I should just be able to do my earnings / duration = dollars per hour amount
or in my chart's terms:
{minus fees} / {duration (show)} = $ per hour amount
However, instead of getting a nice dollar value, this is what I see:
I feel like I'm missing something incredibly obvious here because obviously,
$1,124.17 / 7 hours does not equal $0.04 cents.
It should be $160.56.
Can someone spot where I've gone wrong?
Thanks!
Solved! Go to Solution.
Nov 01, 2023 06:14 AM
Thanks for the screenshots.
It looks like you do not have units for your DATETIME_DIFF() formula. Since you want to display the result as a duration, you should explicitly use “seconds” as the units.
Duration fields are stored as a number of seconds. If you want dollars per hour, you need to convert seconds to hours. 1 hour is 3600 seconds.
Notice that $160.56/hour is the same as $0.0446/second, which rounds to $0.04
Nov 01, 2023 06:17 AM
"Duration Format" is the number of seconds.
For 7 hours, this would be 25200 seconds.
To convert seconds to hours, it needs to be multiplied by 3,600.
{minus fees} / {duration (show)} * 3600
Nov 01, 2023 06:14 AM
Thanks for the screenshots.
It looks like you do not have units for your DATETIME_DIFF() formula. Since you want to display the result as a duration, you should explicitly use “seconds” as the units.
Duration fields are stored as a number of seconds. If you want dollars per hour, you need to convert seconds to hours. 1 hour is 3600 seconds.
Notice that $160.56/hour is the same as $0.0446/second, which rounds to $0.04
Nov 01, 2023 06:16 AM
Oh! Thank you so much - I had previously looked up the datetime_diff() and someone had mentioned not to include units!
(Also didn't even consider that it was dividing by seconds, good catch!)
Nov 01, 2023 06:17 AM
"Duration Format" is the number of seconds.
For 7 hours, this would be 25200 seconds.
To convert seconds to hours, it needs to be multiplied by 3,600.
{minus fees} / {duration (show)} * 3600
Nov 01, 2023 06:21 AM
This is actually what I ended up doing!