Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello all,
I have a dashboard to measure the % of people working in office compared to working from home.
But for the life of me, I am unable to make a DAX that shows the average % of time spent in the office. Is anyone able to show me how this could be done?
Here's what I'm using at the moment:
Table: "Register"
Agent Name | Weekday | Date DD/MMMM | AM/PM | Status |
John | Monday | 03 October | AM | IO |
John | Monday | 03 October | PM | WFH |
Status:
IO - In Office
WFH - Working from Home
OOO - Out of Office
Current DAX to work out % "In Office"
Solved! Go to Solution.
Hi @Natasha93 ,
According to your description, if you want to show the percentage of people who are in office each day, here's my solution.
Sample:
Create a measure:
Measure =
VAR _IO =
CALCULATE ( DISTINCTCOUNT ( Register[Agent Name] ), 'Register'[Status] = "IO" )
VAR _Total =
DISTINCTCOUNT ( Register[Agent Name] )
RETURN
DIVIDE ( _IO, _Total )
Get the result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Natasha93 ,
According to your description, if you want to show the percentage of people who are in office each day, here's my solution.
Sample:
Create a measure:
Measure =
VAR _IO =
CALCULATE ( DISTINCTCOUNT ( Register[Agent Name] ), 'Register'[Status] = "IO" )
VAR _Total =
DISTINCTCOUNT ( Register[Agent Name] )
RETURN
DIVIDE ( _IO, _Total )
Get the result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Natasha93,
The formula posted by you seems to work for me.
In Office Percentage =
Var All_Working_Days = CALCULATE(COUNT('Register'[Date]),('Register'[Status] <> "OOO" || 'Register'[Status] <> BLANK()))
Var In_Office = CALCULATE(COUNT('Register'[Date]),('Register'[Status] = "IO"))
RETURN
DIVIDE(In_Office, All_Working_Days)
The person was in office 50% of the time. That makes sense to me. Is there a chance that you want to calculate the percentage considering some other condition as well? If yes, some sample data would be of great help.
Did I answer your question? Mark this post as a solution if I did!
Consider taking a look at my blog: Forecast Period - Graphical Comparison
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
84 | |
83 | |
67 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |