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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Return Time based on conditions

I have calculated column below that returns count of job bookings based on the job booking datetime where if booking made after 12midday AND picked up by the close of business SAME day, return Yes else No.

 

JB>12 = VAR _HOUR = HOUR(FreightForward[JOB_BOOKING_DATETIME]) RETURN
IF( _HOUR >= 12 && _HOUR <= 24, "Yes","No")

 

I need to modify measure based on the following:

if booking made after 12midday AND picked up by the close of business NEXT day, return Yes else No (i.e. booking after 12midday, picked up next day by 11.59pm Note: measure should also include bookings picked up after 12midday on the same day)

Hope that makes sense. Appreciate any help, thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a formula like

JB>12 = VAR _HOUR = HOUR(FreightForward[JOB_BOOKING_DATETIME])
var _pickup = date(year(FreightForward[JOB_BOOKING_DATETIME]), month(FreightForward[JOB_BOOKING_DATETIME]), Day(FreightForward[JOB_BOOKING_DATETIME])+1)+time(23:59:59)

RETURN
IF( _HOUR >= 12 && _HOUR <= 24 && FreightForward[JOB_PICKUP_DATETIME] <=_pickup, "Yes","No")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a formula like

JB>12 = VAR _HOUR = HOUR(FreightForward[JOB_BOOKING_DATETIME])
var _pickup = date(year(FreightForward[JOB_BOOKING_DATETIME]), month(FreightForward[JOB_BOOKING_DATETIME]), Day(FreightForward[JOB_BOOKING_DATETIME])+1)+time(23:59:59)

RETURN
IF( _HOUR >= 12 && _HOUR <= 24 && FreightForward[JOB_PICKUP_DATETIME] <=_pickup, "Yes","No")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you @amitchandak, much apprecaited

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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