The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
Please let me know if I need to clarify anything.
Thank you verymuch.
Unit | Location | Date | Shift starts | Shift ends | Hours |
a | living room | 11/1/2021 | 10/31/2021 9:00 PM | 11/1/2021 5:00 AM | 8 |
a | living room | 11/1/2021 | 11/1/2021 5:00 AM | 11/1/2021 1:00 PM | 8 |
a | living room | 11/1/2021 | 11/1/2021 1:00 PM | 11/1/2021 9:00 PM | 8 |
a | kitchen | 11/1/2021 | 11/1/2021 12:00 AM | 11/1/2021 8:00 AM | 8 |
a | kitchen | 11/1/2021 | 11/1/2021 12:00 PM | 11/1/2021 8:00 PM | 8 |
b | Room1 | 11/1/2021 | 11/1/2021 12:00 AM | 11/1/2021 12:00 PM | 12 |
b | Room1 | 11/1/2021 | 11/1/2021 12:00 PM | 11/1/2021 10:00 PM | 10 |
c | Dining | 11/1/2021 | 11/1/2021 6:00 AM | 11/1/2021 2:00 AM | 8 |
c | Closet | 11/1/2021 | 10/31/2021 9:00 PM | 11/1/2021 5:00 AM | 8 |
c | Closet | 11/1/2021 | 11/1/2021 5:00 AM | 11/1/2021 1:00 PM | 8 |
c | Closet | 11/1/2021 | 11/1/2021 1:00 PM | 11/1/2021 9:00 PM | 8 |
a | living room | 11/2/2021 | 10/31/2021 9:00 PM | 11/1/2021 5:00 AM | 8 |
a | living room | 11/2/2021 | 11/1/2021 5:00 AM | 11/1/2021 1:00 PM | 8 |
Expected Output 1 assumming a 24hour period i.e. each day:
Unit | Location | Date | Total Hours | % Coverage |
a | living room | 11/1/2021 | 24 | 100% |
a | living room | 11/2/2021 | 16 | 67% |
b | Room1 | 11/1/2021 | 22 | 92% |
c | Dining | 11/1/2021 | 8 | 33% |
c | Closet | 11/1/2021 | 24 | 100% |
Output 2:
Unit | % Coverage |
a | 83% |
b | 92% |
c | 67% |
Solved! Go to Solution.
Hi @yve214
Can you add more details about how did you calculate the % Coverage?
BTW, try this measure:
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.
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)
Hi @yve214
Can you add more details about how did you calculate the % Coverage?
BTW, try this measure:
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.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |