cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dsmitha
Resolver I
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
tom480
Resolver I
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 Time2New column Time2Create your buckets with IFsCreate your buckets with IFs

View solution in original post

2 REPLIES 2
tom480
Resolver I
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 Time2New column Time2Create your buckets with IFsCreate your buckets with IFs

Hi tom480,

 

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

 

regards,

dsmitha

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors