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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need help with the Datediff functionality

I am trying to calculate the date difference between two dates that can only be defined by another column. I have a table with three columns i.e taskname,taskstartdate, taskfinishdate

 

TaskName         TaskStartDate      TaskFinishDate

TaskName1       10/08/2017          01/08/2018

TaskName2       01/09/2018          05/04/2018

 

Now I need the date difference between Taskname1-TaskStartdate and Taskname2-TaskFinishdate so that I can calculate the total duration of the project from start to finish and I can't take the difference of the projectstartdate and projectfinishdate as there might be other tasks associated with the project that are beginning and ending before or after these tasks.

 

Any help would be apprieciated.

 

Thanks

Sridhar

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

I tried different ways to calculate the date difference between two diffrent rows of two different colunms but I couldn't for abvious reasons. So we changed the underlying data to reflect that for any given task we shall have the start and the finish date for the corresponding taskname which are associated with the primary key(projectid). Then I can compute the date difference normally. For now this is the alternative workaround for this issue.

 

Thanks

Sridhar

View solution in original post

3 REPLIES 3
hemal_kanjia
Helper I
Helper I

@Anonymous

 

 

Try this Formula:

 

DATEDIFF(TaskStartDate,TaskFinishDate,Day)

 

 

 

-Hemal

Anonymous
Not applicable

@hemal_kanjia I tried that but the issue I am facing is that I need the datediff between taskname1-taskstartdate and taskname2-taskfinishdate. If I use the above formula it would only give me the date difference between taskname1-taskstartdate and taskfinishdate. I wrote a DAX query but I am not getting any output

 

Duration_Metric7 = DATEDIFF((IF('Tasks-Metric7'[TaskName]="Taskname2",'Tasks-Metric7'[TaskFinishDate].[Date])),(IF('Tasks-Metric7'[TaskName]="Taskname1",'Tasks-Metric7'[TaskStartDate] .[Date])),DAY)

 

Please let me know if you can tweak the above formula to compute the difference. Any help would be appreciated. 

Anonymous
Not applicable

Hi,

 

I tried different ways to calculate the date difference between two diffrent rows of two different colunms but I couldn't for abvious reasons. So we changed the underlying data to reflect that for any given task we shall have the start and the finish date for the corresponding taskname which are associated with the primary key(projectid). Then I can compute the date difference normally. For now this is the alternative workaround for this issue.

 

Thanks

Sridhar

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.