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! Learn more

Reply
Anonymous
Not applicable

How to calculate date difference within same column

Hi everyone,

 

Good afternoon! I would like to ask how to get the date difference of the start and end date in one column (the same column).

I have a different status for each track ID, but I need to get the date difference per status. Is it possible to calculate within same column? (Note: S - start date, E - end date)

katerinepr_0-1649052885209.png

 

1 ACCEPTED SOLUTION
AntonioM
Solution Sage
Solution Sage

Hi, If you want to add a new column, I would try

 

StartToEnd =

VAR startdate = CALCULATE(MIN(Table[Signoff Date]),FILTER(Table, Table[Change Number] = EARLIER(Table[Change Number]) && Table[Status] = EARLIER(Table[Status])))

VAR enddate = CALCULATE(MAX(Table[Signoff Date]),FILTER(Table, Table[Change Number] = EARLIER(Table[Change Number]) && Table[Status] = EARLIER(Table[Status])))

RETURN DATEDIFF(startdate, enddate, DAY)

 

That should give you a duration for each combination of Change Number and Status

View solution in original post

2 REPLIES 2
AntonioM
Solution Sage
Solution Sage

Hi, If you want to add a new column, I would try

 

StartToEnd =

VAR startdate = CALCULATE(MIN(Table[Signoff Date]),FILTER(Table, Table[Change Number] = EARLIER(Table[Change Number]) && Table[Status] = EARLIER(Table[Status])))

VAR enddate = CALCULATE(MAX(Table[Signoff Date]),FILTER(Table, Table[Change Number] = EARLIER(Table[Change Number]) && Table[Status] = EARLIER(Table[Status])))

RETURN DATEDIFF(startdate, enddate, DAY)

 

That should give you a duration for each combination of Change Number and Status

Anonymous
Not applicable

Hi! Thanks a lot for this! It worked perfectly. To add, could you also help me how can I remove weekends in the calculation? Appreciate your help.

Helpful resources

Announcements
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!

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.