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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RobBeijers312
Helper I
Helper I

Events in progress with datediff

Hi,

 

For a report on sick days I need to calculate the datediff between startdate and enddate. If the enddate is 1-1-2100 the enddate is today. While this is no problem I cant get it to work if I need to use it per period. For example, employeeid 8 has 162 sick days till today. 86 of them are in 2024 and 76 are in 2025. Can anyone help me with this measure?

RobBeijers312_0-1742218613401.png

RobBeijers312_1-1742218824449.png

This is the current measure:

Aantal dagen ziek =
VAR mindatum = IF(MIN(Dimdatum[Date]) <= MAX(Ziekmeldingen[startdate]),MAX(Ziekmeldingen[startdate]),MIN(Dimdatum[Date]))
VAR maxdatum = IF(MAX(Ziekmeldingen[enddate]) <= MAX(Dimdatum[Date]),MAX(Ziekmeldingen[enddate]),MAX(Dimdatum[Date]))
VAR aantaldagenziek = CALCULATE(DATEDIFF(mindatum,maxdatum,DAY),REMOVEFILTERS(Dimdatum),Ziekmeldingen[startdate] <= maxdatum,Ziekmeldingen[enddate] >= mindatum)

 

1 ACCEPTED SOLUTION

@RobBeijers312 , refer

Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM

Power BI- DAX: Get all dates between the Start and End date: https://youtu.be/y7AL_quvq5w

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

 If the enddate is 1-1-2100

Don't do that.  Leave the end date BLANK in these cases. Otherwise your calendar is ballooning unnecessarily.

 

Consider using CALENDAR and COUNTROWS(INTERSECT()) as an alternative approach.

amitchandak
Super User
Super User

@RobBeijers312 ,

You can use datediff or workdays as per need

 

New column =

var _max = If([enddate] = date(2100,1,1), today(), [enddate])

return

datediff([startdate], _max, day)

 

or networkdays([startdate], _max, 1)

 

 

Power BI - Business day with and without using DAX Function NETWORKDAYS: https://www.youtube.com/watch?v=Qs03ZZXXE_c
https://medium.com/@amitchandak/power-bi-dax-function-networkdays-5c8e4aca38c 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

Thanks for your response.

I probably wasn't really clear in my questioning, but the new column ain't the problem. For a report I need the sick days per month and per year. For example, employeeid 8 has 162 sick days till today. 86 of them are in 2024 and 76 are in 2025.

@RobBeijers312 , refer

Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM

Power BI- DAX: Get all dates between the Start and End date: https://youtu.be/y7AL_quvq5w

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak 

Many thanks for the instruction vids. This was exactly what I needed!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors