9 Replies Latest reply on Jun 3, 2016 10:35 AM by Gurpreet Singh Goraya

# Group Time

Hello All,

I am very new with Tableau desktop. Hopefully, I will get some help with my questions. I am trying to create an hourly group of negotiated time and the sum of the trips as group.

I want to acheive the following:

6 AM - 7 AM =419

7 Am - 8 AM = 1405 and so on.

GG

• ###### 1. Re: Group Time

You have 2 options:

1. Create a group and put individual times into buckets. That's tedious.
2. Create a calculation that would truncate minutes. Something like LEFT([Negtime],2) + " - " STR(INT(LEFT([Negtime],2))+1)
• ###### 2. Re: Group Time

Thank you so much to the answer, now I am getting the following error when creating Calculation:

"Syntax error, may be missing an operator"

• ###### 3. Re: Group Time

I haven't tried it myself

What type is Negtime? String or Date&Time?

Basically you take first two symbols (which will be hours) then add dash (" - ") then get hours again, convert it to number, add 1 and convert back to string. Idea is for "06:35" is to get "6 - 7".

• ###### 4. Re: Group Time

Negtime is in String. Thanks

• ###### 5. Re: Group Time

Oh yeah, I missed the "+".

Here's the formula (also attached workbook):

STR(INT(LEFT([Negtime],2))) + " to " + STR(INT(LEFT([Negtime],2))+1)

1 of 1 people found this helpful
• ###### 6. Re: Group Time

Great! Thank you for your help. It works great. I achieved that I was trying to.

GG

• ###### 7. Re: Group Time

Another question related to the same. Now I need to convert two hours time interval (two hours time Group) instead of one.  How to change the calculations formula.Thank you in advance.

GG

• ###### 8. Re: Group Time

I'm going to point you here so you can self-educate

• ###### 9. Re: Group Time

Thanks, appreciated.

GG