Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have the following table list of individuals and their related occurences
Id | First Name | Incident Date | Is this a new incident? | Was medical attention sought? | Were work restrictions put into place? | Date placed on light duty | Date reported | Date cleared for duty | Date removed from duty |
8 | Gloria | 5/26/2024 | Yes | No |
|
| 5/26/2024 | 5/31/2024 | 5/26/2024 |
9 | Gloria | 2/20/2025 | Yes | Yes | Yes, the employee was removed from duty | 2/20/2025 | 2/20/2025 | ||
10 | Gloria | 2/20/2025 | No |
| Yes, the employee was given limitations | 4/1/2025 |
|
|
|
11 | Gloria | 2/20/2025 | No | No work restrictions | 5/12/2025 | ||||
12 | Rebeccah | 4/1/2025 | Yes | Yes | Yes, the employee was removed from duty |
| 4/1/2025 |
| 4/4/2025 |
13 | Rebeccah | 4/1/2025 | No | Yes, the employee was given limitations | 4/16/2025 | ||||
14 | Rebeccah | 4/1/2025 | No |
| Yes, the employee was removed from duty |
|
|
| 4/30/2025 |
15 | Rebeccah | 4/1/2025 | No | Yes, the employee was given limitations | 5/21/2025 | ||||
16 | Diana | 6/17/2025 | Yes | Yes | No work restrictions |
| 6/17/2025 | 6/17/2025 |
|
Scenario I
Gloria has an accident on 5/26/2024.
Scenario II
Diana has an accident on 6/17/2025.
Scenario III
Gloria has an accident on 2/20/2025.
Scenario IV
Rebeccah has an accident on 4/1/2025.
Problem
Using DAX, compute the following:
I would appreciste any assistance with the above.
Thanks,
Hi @rdehatheba55 , Thank you for reaching out to the Microsoft Community Forum.
I took your sample data, cleaned it (for example your date format is in different ways, made it one way) and reproduced your scenario, with working solution.
For your reference, I’ve attached the working .pbix file.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hello v-hashadapu,
I am not seeing any attachment
Thanks,
Raphael
Hi @rdehatheba55 , Sorry for the inconvinience, looks like the .pbix didn't get attached properly. Re attaching it now. Please check it and share your thoughts.
Thank you.
Hi @rdehatheba55 have tested this and it seems to be working , please try this
Create a calculated table
Hi @rdehatheba55 ,
This can be achieved by using the following 2 measures:
Days on Light Duty :=
SUMX(
FILTER(
'Table',
NOT ISBLANK('Table'[Date placed on light duty]) &&
NOT ISBLANK('Table'[Date cleared for duty])
),
DATEDIFF(
'Table'[Date placed on light duty],
'Table'[Date cleared for duty],
DAY
)
)
Days Out of Work :=
SUMX(
FILTER(
'Table',
NOT ISBLANK('Table'[Date removed from duty]) &&
(
NOT ISBLANK('Table'[Date placed on light duty]) ||
NOT ISBLANK('Table'[Date cleared for duty])
)
),
VAR StartDate = 'Table'[Date removed from duty]
VAR EndDate =
IF(
NOT ISBLANK('Table'[Date placed on light duty]),
'Table'[Date placed on light duty],
'Table'[Date cleared for duty]
)
RETURN
DATEDIFF(StartDate, EndDate, DAY)
)
Please make sure to replace 'Table' with your actual table name. In terms of how to utilize each measure based on your request:
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Connect with me on LinkedIn
Check out my Blog
Going to the European Microsoft Fabric Community Conference? Check out my Session
Samson,
I hate to disappoint but I am getting no yield from the calculated tables and therefore cannot move any further. I not sure what I am doing wrong.
Samson,
I converted your formulas using the right table name (See below) and the result is zero.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
9 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
8 |