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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
jakoob
Frequent Visitor

Calculated Column Based on Time

Hi,

 

I'm new to DAX and im having some trouble with creating a calculated colum based off the time stamp of a row.

 

I have some data that looks like this:

Ticket IDCreate Date/Time
11/15/2023 4:36:18 PM
21/19/2023 11:00:30 AM
31/23/2023 1:12:35 PM
41/24/2023 8:41:43 AM
51/26/2023 3:17:16 AM

 

I am trying to make a calculated column that would calculate if a ticket was created either during or outside of business hours (8:30 AM - 5:00 PM). Im trying to get something like the following result:

Ticket IDCreate Date/TimeCreated On Hours
11/15/2023 4:36:18 AMNo
21/19/2023 11:00:30 AMYes
31/23/2023 1:12:35 PMYes
41/24/2023 8:41:43 AMYes
51/26/2023 3:17:16 AMNo

 

I am using the following DAX statement and all I get are rows stamped with "Yes" even if a rows Date/Time is outside of the standard business hours I defined in the DAX statement.

 

 

Created On Hours = IF(AND('Ticket Data'[Date/Time] > TIME(08,29,00), 'Ticket Data'[Date/Time] < TIME(17,00,00)),"Yes","No")

 

 

 

Any help would be appreciated!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jakoob 

Please try

Created On Hours =
IF (
AND (
TIMEVALUE ( 'Ticket Data'[Date/Time] ) > TIME ( 08, 29, 00 ),
TIMEVALUE ( 'Ticket Data'[Date/Time] ) < TIME ( 17, 00, 00 )
),
"Yes",
"No"
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @jakoob 

Please try

Created On Hours =
IF (
AND (
TIMEVALUE ( 'Ticket Data'[Date/Time] ) > TIME ( 08, 29, 00 ),
TIMEVALUE ( 'Ticket Data'[Date/Time] ) < TIME ( 17, 00, 00 )
),
"Yes",
"No"
)

Thank you so much! Works perfectly!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.