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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Need help with a DAX

Hello All,

 

I'm stuck with a query to find the date difference in my data set.

 

Emp NameProcessCreated DateCompleted Date
Emp 1Hire1/1/20231/2/2023
Emp1Contract1/5/20231/6/2023

 

I need to calculate the difference between the created and completed date (highlighted in bold), but I'm unable to get the dax for the same. Can anyone help me write this out?

Thanks for the help in advance!!

1 ACCEPTED SOLUTION
Igna
Resolver III
Resolver III

Hello,

 

You could try to calculate the difference between the minimum created date and the maximum completed date for a Emp :

 

Date Difference = 
VAR MinCreateDate = CALCULATE(MIN('YourTable'[Created Date]), ALLEXCEPT('YourTable', 'YourTable'[EmpName]))
VAR MaxCompletedDate = CALCULATE(MAX('YourTable'[Completed Date]), ALLEXCEPT('YourTable', 'YourTable'[EmpName]))
RETURN MaxCompletedDate - MinCreateDate

 

 

Tell me if this works 🙂

 

Igna

View solution in original post

4 REPLIES 4
ChiragGarg2512
Solution Sage
Solution Sage

Oh, ok

Igna
Resolver III
Resolver III

Hello,

 

You could try to calculate the difference between the minimum created date and the maximum completed date for a Emp :

 

Date Difference = 
VAR MinCreateDate = CALCULATE(MIN('YourTable'[Created Date]), ALLEXCEPT('YourTable', 'YourTable'[EmpName]))
VAR MaxCompletedDate = CALCULATE(MAX('YourTable'[Completed Date]), ALLEXCEPT('YourTable', 'YourTable'[EmpName]))
RETURN MaxCompletedDate - MinCreateDate

 

 

Tell me if this works 🙂

 

Igna

ChiragGarg2512
Solution Sage
Solution Sage

Create a column using datediff function.

Ex. 

datediff = DATEDIFF(q2[Created Date], q2[Completed Date], DAY)
 
**q2 is table name.

This will not work as the two dates are not in the same row

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
Top Kudoed Authors