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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
yve214
Helper III
Helper III

Dax Help with Percentage shifts covered by Unit

Hi there,

Please I need help with some dax. I have been stuck on a problem and I need some guidance to obtain the outputs below.

 

  1. I need to be able to calculate the percentage of shifts covered within in a 24 hour period between a selected range of dates say like (11/1/2021 - 12/30/2021) . For instance, looking at this small sample data betwen 11/1/2021 - 11/2/2021,  I need to be able to calculate shifts covered within a 24hour period as a percentage and be able to view the average results grouped by location and or Unit.

Please let me know if I need to clarify anything.

Thank you verymuch.

 

UnitLocationDateShift startsShift endsHours
aliving room11/1/202110/31/2021 9:00 PM11/1/2021 5:00 AM8
aliving room11/1/202111/1/2021 5:00 AM11/1/2021 1:00 PM8
aliving room11/1/202111/1/2021 1:00 PM11/1/2021 9:00 PM8
akitchen11/1/202111/1/2021 12:00 AM11/1/2021 8:00 AM8
akitchen11/1/202111/1/2021 12:00 PM11/1/2021 8:00 PM8
bRoom111/1/202111/1/2021 12:00 AM11/1/2021 12:00 PM12
bRoom111/1/202111/1/2021 12:00 PM11/1/2021 10:00 PM10
cDining11/1/202111/1/2021 6:00 AM11/1/2021 2:00 AM8
cCloset11/1/202110/31/2021 9:00 PM11/1/2021 5:00 AM8
cCloset11/1/202111/1/2021 5:00 AM11/1/2021 1:00 PM8
cCloset11/1/202111/1/2021 1:00 PM11/1/2021 9:00 PM8
aliving room11/2/202110/31/2021 9:00 PM11/1/2021 5:00 AM8
aliving room11/2/202111/1/2021 5:00 AM11/1/2021 1:00 PM8

 

Expected Output 1 assumming a 24hour period i.e. each day:

UnitLocationDateTotal Hours% Coverage
aliving room11/1/202124100%
aliving room11/2/20211667%
bRoom111/1/20212292%
cDining11/1/2021833%
cCloset11/1/202124100%

 

Output 2:

Unit% Coverage
a83%
b92%
c67%
2 ACCEPTED SOLUTIONS
VahidDM
Super User
Super User

Hi @yve214 

 

Can you add more details about how did you calculate the  % Coverage?

 

BTW, try this measure:

% Coverage =
Var _C = DISTINCTCOUNT('Table'[Date])
return
sum('Table'[Hours])/(_C*24)
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

View solution in original post

Hi Vahid,

 

Thank you very much for your help, This helped and i got exactly what i needed. 

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Maybe I understand what you mean.Please try to modify the formula provided before like below:

% Coverage = 
Var _C = DISTINCTCOUNT('Table'[Date])+DISTINCTCOUNT('Table'[Location])-1
return
sum('Table'[Hours])/(_C*24)
 

Vlianlmsft_0-1637636609547.pngVlianlmsft_1-1637636632519.png

 

VahidDM
Super User
Super User

Hi @yve214 

 

Can you add more details about how did you calculate the  % Coverage?

 

BTW, try this measure:

% Coverage =
Var _C = DISTINCTCOUNT('Table'[Date])
return
sum('Table'[Hours])/(_C*24)
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

Hi Vahid,

 

Thank you very much for your help, This helped and i got exactly what i needed. 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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