Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dsmitha
Responsive Resident
Responsive Resident

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
dsmitha
Responsive Resident
Responsive Resident

Hi tom480,

 

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

 

regards,

dsmitha

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.