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
bhmiller89
Helper V
Helper V

column to designate "working Hours"

I have data for help desk tickets and each ticket has a "resolved date" which is date/time format. I also have a invoked calendar function that includes things like DayofWeekName (Monday,etc), DayInWeek (Friday=5, etc) 

 

I need to find a way to designate whether or not a ticket was resolved within "working hours" which is Monday-Friday 8AM-6PM 

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @bhmiller89,

 

1. I would suggest you add one column to the calendar table.

isWorkDay =
IF ( WEEKDAY ( [Date], 2 ) IN { 6, 7 }, 0, 1 )

2. Add calculated column like below.

ifWithinWH =
VAR rDate =
    DATEVALUE ( [Resolved Date] )
VAR rTime =
    TIMEVALUE ( [Resolved Date] )
RETURN
    IF (
        rDate
            IN CALCULATETABLE ( VALUES ( 'Calendar'[Date] ), 'Calendar'[isWorkDay] = 1 ),
        IF ( rTime >= TIME ( 8, 0, 0 ) && rtime <= TIME ( 18, 0, 0 ), 1, 0 ),
        0
    )

column_to_designate

 

Best Regards,

Dale

Community Support Team _ Dale
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

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @bhmiller89,

 

1. I would suggest you add one column to the calendar table.

isWorkDay =
IF ( WEEKDAY ( [Date], 2 ) IN { 6, 7 }, 0, 1 )

2. Add calculated column like below.

ifWithinWH =
VAR rDate =
    DATEVALUE ( [Resolved Date] )
VAR rTime =
    TIMEVALUE ( [Resolved Date] )
RETURN
    IF (
        rDate
            IN CALCULATETABLE ( VALUES ( 'Calendar'[Date] ), 'Calendar'[isWorkDay] = 1 ),
        IF ( rTime >= TIME ( 8, 0, 0 ) && rtime <= TIME ( 18, 0, 0 ), 1, 0 ),
        0
    )

column_to_designate

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
alexei7
Continued Contributor
Continued Contributor

Hi @bhmiller89,

 

I would probably create a time column - you could either create a custom column or split the column into separate "Date" and "Time" columns in the query.

 

Then i'd base the "working hours" calculation on the time column.

 

Hope that helps,

Alex

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.