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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Return Time with conditions

I have two calculated columns that return the count of jobs based on the booking datetime within a 24hour period.

 

 

1. JOBS BEFORE 12

=VAR Time1_ = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME])
VAR Date1_ = INT(FF_Raw_Data[JOB_BOOKING_DATETIME])
RETURN IF(Time1_ < 12, "Yes", "No")

2. JOBS AFTER 12

=VAR Time1_ = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME])
VAR Date1_ = INT(FF_Raw_Data[JOB_BOOKING_DATETIME])
RETURN IF(Time1_ > 12, "Yes", "No")

 

 

I need to edit the measures based on the actual time i.e. if booking datetime >=00:00 midnight and <12pm midday, return YES else NO.

if booking datetime >=12pm and <00:00 midnight, return YES else NO

Appreciate any help, thanks.

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Use below calcualted columns:

Jobs Before 12 = 
VAR _HOUR = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME]) RETURN
IF( _HOUR >= 0 && _HOUR < 12, "YES","NO")

 

Jobs After 12 = 
VAR _HOUR = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME]) RETURN
IF( _HOUR >= 12 && _HOUR <= 24, "YES","NO")

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , I do not think you need a change as <=12 is as good as >0 and < =12

also > 12 is as good as >12 and <=23:59:59

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
Fowmy
Super User
Super User

@Anonymous 

Use below calcualted columns:

Jobs Before 12 = 
VAR _HOUR = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME]) RETURN
IF( _HOUR >= 0 && _HOUR < 12, "YES","NO")

 

Jobs After 12 = 
VAR _HOUR = HOUR(FF_Raw_Data[JOB_BOOKING_DATETIME]) RETURN
IF( _HOUR >= 12 && _HOUR <= 24, "YES","NO")

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmythat worked perfectly, thank you

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.