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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculate date difference over time

Hello community I can't calculate a measure that calculates days lost across 2 dates (beginning of the decline and end of the decline).

 

I have a fact table that shows me all the accidents, the date the accident occurred and the dates of sick leave.

 

How can I calculate the days lost?

 

JoaoSifredo_0-1704673095437.png

 

 

Thanks for the help.

2 REPLIES 2
v-weiyan1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description,
Please try code as below to create a measure.
My Sample:

vweiyan1msft_0-1704795608964.png

The lost days = DATEDIFF(SELECTEDVALUE('Table'[Inicio]),SELECTEDVALUE('Table'[Fim]),DAY)+1

Result is as below.

vweiyan1msft_1-1704795652506.png

Please correct me if I misunderstood your needs.

 

Best Regards,
Yulia Yan

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-weiyan1-msft  Many thanks for the reply.

 

It's not the solution I want. I intend to know how many lost days I have each month. We have sick leave that lasts for several months. After applying slicers, I want to know how many days were lost each month. There may be casualties that start on the same day.

 

 

 

JoaoSifredo_0-1704808857147.png

 

 

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.