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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Rockz
Helper I
Helper I

How to Measure User-Defined `X` Days Considering Working Hours in Issue Tracking Tool

Dear Champions,

 

I am developing an issue tracking tool where users can define a target value `X` (in days) to measure issue processing times. The challenge is to measure this while considering only working hours (Monday to Friday, 08:00 to 16:30).

**Requirement:**

1. Users input `X` days.
2. Calculate processing times considering only working hours.
3. Determine if processing times meet the `X` days target.

Could anyone provide guidance or examples on how to accurately measure `X` days in terms of working hours?

Thank you for your assistance!

This version is concise and directly addresses the need to calculate `X` days based on user input while considering working hours.

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @Rockz ,

Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1720753119642.png

Create measures

Duration = 
VAR StartTime = 
IF(
    SELECTEDVALUE('Table'[Start Time]) <= TIME(8,0,0),
    TIME(8,0,0),
    SELECTEDVALUE('Table'[Start Time])
)
VAR EndTime = 
IF(
    SELECTEDVALUE('Table'[End Time] ) >= TIME(16,30,0),
    TIME(16,30,0),
    SELECTEDVALUE('Table'[End Time])
)
RETURN
IF(
    WEEKDAY(SELECTEDVALUE('Table'[Date])+ 1) <= 5,
    HOUR(EndTime - StartTime) + MINUTE(EndTime - StartTime)/60,
    0
)
Total Days = 
VAR _t = 
SUMMARIZE(
    'Table',
    'Table'[Date],
    'Table'[Start Time],
    'Table'[End Time],
    "Duration",[Duration]
)
RETURN
SUMX(_t,[Duration])/24

Create a numeric parameter

vheqmsft_1-1720753190854.pngvheqmsft_2-1720753211153.png


Create a KPI visualization

vheqmsft_3-1720753265426.png

Fianl output

vheqmsft_4-1720753289503.png

vheqmsft_5-1720753302698.png

 

Best regards,
Albert He

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

1 REPLY 1
v-heq-msft
Community Support
Community Support

Hi @Rockz ,

Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1720753119642.png

Create measures

Duration = 
VAR StartTime = 
IF(
    SELECTEDVALUE('Table'[Start Time]) <= TIME(8,0,0),
    TIME(8,0,0),
    SELECTEDVALUE('Table'[Start Time])
)
VAR EndTime = 
IF(
    SELECTEDVALUE('Table'[End Time] ) >= TIME(16,30,0),
    TIME(16,30,0),
    SELECTEDVALUE('Table'[End Time])
)
RETURN
IF(
    WEEKDAY(SELECTEDVALUE('Table'[Date])+ 1) <= 5,
    HOUR(EndTime - StartTime) + MINUTE(EndTime - StartTime)/60,
    0
)
Total Days = 
VAR _t = 
SUMMARIZE(
    'Table',
    'Table'[Date],
    'Table'[Start Time],
    'Table'[End Time],
    "Duration",[Duration]
)
RETURN
SUMX(_t,[Duration])/24

Create a numeric parameter

vheqmsft_1-1720753190854.pngvheqmsft_2-1720753211153.png


Create a KPI visualization

vheqmsft_3-1720753265426.png

Fianl output

vheqmsft_4-1720753289503.png

vheqmsft_5-1720753302698.png

 

Best regards,
Albert He

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

 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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