cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Anonymous
Not applicable

Re: Need help with the Datediff functionality

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 Regular Visitor
Regular Visitor

Re: Need help with the Datediff functionality

@Anonymous

 

 

Try this Formula:

 

DATEDIFF(TaskStartDate,TaskFinishDate,Day)

 

 

 

-Hemal

Anonymous
Not applicable

Re: Need help with the Datediff functionality

@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

Re: Need help with the Datediff functionality

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

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 267 members 2,651 guests
Please welcome our newest community members: