cancel
Showing results for
Did you mean:
Resolver I

## How to create time bucket

Hi,

Request your guidance to solve  my issue related to time bucket

i have a table which contains a field showing  date and time of sales, sales happens in almost every three minutes gap  during day time, i would like to have these timings seggregated as say 09 am to 11:00 am as  " 9 to 11 " , then 11:00 am to 1:00 pm as "11 to 1" so that when i create a visual it will look more standardised.  please guide me .

regards,

dsmitha

1 ACCEPTED SOLUTION
Resolver I

Hi @dsmitha ,

Lots of ways to do this, here's one in DAX.

1)  Get the time out of the date/time column;

2)  Create your time bucket.  Could also be cleaned up with SWITCH but quick, easy way shown...

Time Bucket = IF ([Time2] < TIME(3,0,0), "0 - 3 AM", IF ([Time2] < TIME(6,0,0), "3 AM - 6 AM", IF ([Time2] < TIME(9,0,0), "6 AM - 9 AM",IF ([Time2] < TIME(12,0,0), "9 AM - 12 PM",IF ([Time2] < TIME(15,0,0), "12 PM - 3 PM","etc..")))))

If this is helpful, please mark as a solution to help others find solutions too!  Always glad to help!  Tom

New column Time2Create your buckets with IFs
2 REPLIES 2
Resolver I

Hi @dsmitha ,

Lots of ways to do this, here's one in DAX.

1)  Get the time out of the date/time column;

2)  Create your time bucket.  Could also be cleaned up with SWITCH but quick, easy way shown...

Time Bucket = IF ([Time2] < TIME(3,0,0), "0 - 3 AM", IF ([Time2] < TIME(6,0,0), "3 AM - 6 AM", IF ([Time2] < TIME(9,0,0), "6 AM - 9 AM",IF ([Time2] < TIME(12,0,0), "9 AM - 12 PM",IF ([Time2] < TIME(15,0,0), "12 PM - 3 PM","etc..")))))

If this is helpful, please mark as a solution to help others find solutions too!  Always glad to help!  Tom

New column Time2Create your buckets with IFs
Resolver I

Hi tom480,

thanks a ton  for your quick and simple solution,  great !

regards,

dsmitha

Announcements