cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TinyElephant
Helper II
Helper II

Calculate Utilization percentage

Consider the below table. I have a slicer list of employees and a Date Range visual. I want to display the utilization percentage on a Gauge chart. 

 

Utilization Percentage in a particular duration = (Total Business Hours - No Work Hours)/Total Business Hours

Where

Total Business Hours = Work Days x 8

Work Days = All Days in the duration - Holidays

 

TinyElephant_1-1628488072107.png

 

EmployeeWorkHoursDate
Person 1Task 1409-Aug-21
Person 1No Work209-Aug-21
Person 1Task 2209-Aug-21
Person 2Task1309-Aug-21
Person 2Task 2109-Aug-21
Person 2Leave409-Aug-21
Person 3No Work309-Aug-21
Person 3Task 2509-Aug-21
Person 1Holiday810-Aug-21
Person 2Holiday810-Aug-21
Person 3Holiday810-Aug-21
1 ACCEPTED SOLUTION

Hi @TinyElephant ,

 

If you want to filter out the Holiday or Overtime part, you can modify the following formula like below:

1 =
VAR total_bus =
    (
        COUNTROWS ( 'Table' )
            - CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER ( 'Table', 'Table'[Work] = "Holiday" || 'Table[Work]' = "Overtime" )
            )
    ) * 8
VAR no_work =
    SUMX ( FILTER ( 'Table', 'Table'[Work] = "No Work" ), 'Table'[Hours] )
RETURN
    DIVIDE ( total_bus - no_work, total_bus )


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

9 REPLIES 9
v-henryk-mstf
Community Support
Community Support

Hi @TinyElephant ,

 

Based on your needs, I create the corresponding formula, refer to the following:

1 =
VAR total_bus =
    (
        COUNTROWS ( 'Table' )
            - CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER ( 'Table', 'Table'[Work] = "Holiday" )
            )
    ) * 8
VAR no_work =
    SUMX ( FILTER ( 'Table', 'Table'[Work] = "No Work" ), 'Table'[Hours] )
RETURN
    DIVIDE ( total_bus - no_work, total_bus )


 If there is a problem, please point out the clear error and I will answer it for you as soon as possible.


Best Regards,
Henry


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

It seems to work for now. A little bit more precision would be great.
Now I came to think of the situation when some employees might work on weekend and the table may have entries for these weekend work which needs to be ignored.

 

Is it possible to use the formulae (1 and 2) I annotated in the attached image?

 

TinyElephant_0-1628666597649.png

 

Hi @TinyElephant ,

 

If the formula is created correctly, adding it to the corresponding visual will work correctly.


Best Regards,
Henry


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

Is this syntax right for filtering out "overtime" entries? 

 

1 =
VAR total_bus =
    (
        COUNTROWS ( 'Table' )
            - CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER ( 'Table', 'Table'[Work] = "Holiday" && 'Table[Work]' = "Overtime" )
            )
    ) * 8
VAR no_work =
    SUMX ( FILTER ( 'Table', 'Table'[Work] = "No Work" ), 'Table'[Hours] )
RETURN
    DIVIDE ( total_bus - no_work, total_bus )

 

Hi @TinyElephant ,

 

If you want to filter out the Holiday or Overtime part, you can modify the following formula like below:

1 =
VAR total_bus =
    (
        COUNTROWS ( 'Table' )
            - CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER ( 'Table', 'Table'[Work] = "Holiday" || 'Table[Work]' = "Overtime" )
            )
    ) * 8
VAR no_work =
    SUMX ( FILTER ( 'Table', 'Table'[Work] = "No Work" ), 'Table'[Hours] )
RETURN
    DIVIDE ( total_bus - no_work, total_bus )


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

amitchandak
Super User
Super User

@TinyElephant , Do you have table with business days ?

Or that can be distinct values of dates ?



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

My raw data table has entries for each and every day. 

@TinyElephant , Try a measure like

 


var _bh = distinctCOUNT(Table[Employee])*distinctCOUNT(Table[Date]) *8
var _hr = sux(filter(Table, Table[Work] <> "No Work")
return
calculate(divide(_bh-_hr, _bh), filter(Table, Table[Work] <> "Holiday"))



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

It's showing some error with the syntax.

 

TinyElephant_0-1628493180107.png

 

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors