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.
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
Employee | Work | Hours | Date |
Person 1 | Task 1 | 4 | 09-Aug-21 |
Person 1 | No Work | 2 | 09-Aug-21 |
Person 1 | Task 2 | 2 | 09-Aug-21 |
Person 2 | Task1 | 3 | 09-Aug-21 |
Person 2 | Task 2 | 1 | 09-Aug-21 |
Person 2 | Leave | 4 | 09-Aug-21 |
Person 3 | No Work | 3 | 09-Aug-21 |
Person 3 | Task 2 | 5 | 09-Aug-21 |
Person 1 | Holiday | 8 | 10-Aug-21 |
Person 2 | Holiday | 8 | 10-Aug-21 |
Person 3 | Holiday | 8 | 10-Aug-21 |
Solved! Go to 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.
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?
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.
@TinyElephant , Do you have table with business days ?
Or that can be distinct values of dates ?
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"))
It's showing some error with the syntax.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |