# Calculating duration for children fun park

Hi,

New here, now struggling to create the flow for a children fun park.

Child enters than leaves> system gives the duration in minutes.
Then based on the minutes it played in the park it will need to take a certain price. We have no price for under 30 minutes, then price 1 from 30 to 60, price 2 from 60 to 90 minutes, etc.

I’m using an if to calculate, but for some reason is neither taking the price from the created columns or neither from the custom number entered.

Attached screenshots showing how time is taken.
Columns with differrent tiers.
lastly the if calculation.

Thank you all!

You’re not comparing the same things. You are comparing whole numbers to durations which are basically fractions of one day. Essentially what you are doing is comparing the equivalent of 30/60/90 DAYS to your time duration. Not minutes.

What you need is the decimal form of minutes.

• 30 Min = 0.0208
• 60 Min = 0.04167
• 90 Min = 0.0625
1 Like

Hi,

Thank you for the update.
Can you tell me how did you manage to calculate it?

• One day equals 1.
• There are 24 hours in a day. 1/24≈0.04167 which represents 1 hour.
• There are 60 minutes in an hour (1/24)/60≈0.000694 which represents 1 minute.
• Take that result and multiple by the number of minutes you need. For example if we need the equivalent of 30 minutes, then 1/24/60*30≈0.0208
1 Like

Hi,

Apologies again.

As you can see i’m calculating this in the math, but is again giving me the same format. No option to add decimals.

How is your MinutesSpent column calculated? I assume is just a subtraction between Leave Time and Entry Time?

That’s the point I’m trying to make. If your MinutesSpent is 30 minutes, the underlying value is still 0.0208, so now you are taking an incredibly small number and multiplying by an incredibly small number, which gives you and even smaller number. Not sure what you are trying to do with that CalculateTime math column.

What I was giving you is the decimal equivalent of 30/60/90 minutes, so you can place them in your IF column so they can be compare to the TimeSpent column, which technically is already a decimal underneath, but displays in a formatted way as minutes.

1 Like

Hi Jeff,

Thank you for the prompt reply!

I understand now. You are also assuming correctly regarding the MinutesSpent.

Calculate time I was just experimenting to see if i will manage to resolve it somehow.

Unfortunately I’m still stuck.

Tried your suggestion as you can see on the screenshot, but don’t know wait is showing me the lowest amount constantly. It is stuck on the frist IF statement.

e

What kind of values do you have in the TotalTimeSpent column?

This is the formula of totaltimespent.

That formula is giving you a duration, which won’t work in your if-then-else column as you have it.

I think you’ll find this a bit simpler if you convert your durations to whole minutes, rather than trying to deal with fractions of days.

So, use the following formula in your Math column:

``````Trunc((LT-ET)*1440)
``````

(where ET is the entry time, and LT is the leave time).
This will give you a duration in whole minutes, which you can then use in your if-then-else column like so:

• If Duration is equal to or greater than 120, then “2 hour price”
• If Duration is greater than 90, then “1.5 hour price”
• If Duration is greater than 60, then “1 hour price”
• If Duration is greater than 30, then “30 min price”
• Else “No charge”

Side note: I can see that you are using User Specific columns for your Entry/Leave times:

Are you aware of the implications of that? In case you aren’t, it means that no user will be able to view the data of any other user. So for example, as an admin you would have no way to aggregate or summarise the data across all users. I suspect this probably isn’t what you want?

3 Likes

Hi Darren,

Thank you it works now.
So you mean, as setupped now can’t create any queries?

Are you referring to my note about User Specific Columns?
The values in User Specific Columns are specific to each user, and every user will see a different value for the same column. To see what I mean, go to the Data Editor and try switching the “Viewing as” to different users. You will see that the values in those columns change (or disappear) as you switch users.

I can’t answer the question of whether or not this is actually what you want - it depends what you intend to do with the data. But if you need to aggregate or summarise it in any way across multiple users, then you shouldn’t use User Specific columns.

1 Like

Just want to note that this was the problem. You took a duration between two dates and divided by 60. Sure it looks nice in its formatted form, but it’s no longer the same value. With that math 0:05 actually becomes 5 seconds, and not minutes. So that is why all of your values fell into your lowest bracket. You were comparing seconds to minutes instead of minutes to minutes.

If you would have removed that division of 60 then it would have worked, but @Darren_Murphy’s method is definitely easier to understand. Just wanted to explain what was happening.

3 Likes

Thank you for clarifying!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.