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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Measure - Normal Hours or OOH

Hello,

 

Is there a measure or DAX I can use to find out if something has been raised in hours or out of hours please?

Normal - Monday - Friday 8am-5pm

OOH - Monday - Friday 5pm - 8am & Saturday - Sunday - All Day

 

Thanks, 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You could try this measure.

Normal Hours or OOH =
VAR _date =
    MAX ( 'Table'[Date] )
VAR _hour =
    HOUR ( _date )
VAR _min =
    MINUTE ( _date )
VAR _sec =
    SECOND ( _date )
VAR _time =
    TIME ( _hour, _min, _sec )
RETURN
    IF (
        WEEKDAY ( _date, 2 ) IN { 6, 7 },
        "OOH",
        IF ( TIME ( 8, 0, 0 ) < _time && _time < TIME ( 17, 0, 0 ), "Normal", "OOH" )
    )

vstephenmsft_0-1649305140625.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

You could try this measure.

Normal Hours or OOH =
VAR _date =
    MAX ( 'Table'[Date] )
VAR _hour =
    HOUR ( _date )
VAR _min =
    MINUTE ( _date )
VAR _sec =
    SECOND ( _date )
VAR _time =
    TIME ( _hour, _min, _sec )
RETURN
    IF (
        WEEKDAY ( _date, 2 ) IN { 6, 7 },
        "OOH",
        IF ( TIME ( 8, 0, 0 ) < _time && _time < TIME ( 17, 0, 0 ), "Normal", "OOH" )
    )

vstephenmsft_0-1649305140625.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Chk = 
VAR __dt = MAX( 'Table'[Date] )
VAR __t = TIMEVALUE( __dt )
RETURN
    IF( WEEKDAY( __dt ) < 6 && __t >= 8 / 24 && __t <= 17 / 24, "Normal", "OOH" )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Hello Stephen,

 

Thank you for helping, unfortunatley its now showing everything as OOH? I've change the date from table to 'Task Created Date' Would this be an issue? Thanks again! 

 

 Capture.JPG 

Anonymous
Not applicable

Hi @Anonymous ,

 

I guess you have a problem with the underline here, you don't need to add ".Date".

13.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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