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
mohammadyousaf
Helper III
Helper III

Duration Calculation between different dates

Hi.. I tried my best but I am stuck and requesting your help for the following from given table. 

 

1. Planned Duration which I can calcualte using= DATEDIFF(MIN('Project Details Sheet'[Planned Start Date]), MAX('Project Details Sheet'[Planned Completion date]),DAY)+0

2. Actual Duration when Task is not in selection, means Total of Actual Duration as of today, but if All tasks has dates than it should not take Today() in calculations and instead take the last date (of K). 

3. Actual Duration when Task is focus

4. Actual Duration should show "In Progress" if task has blank completion 

5. Duration Remaining in all the above cases by taking the planned completion date in consideration 

6. % of Duration , +- in case of days are more than the planned. 

 

mohammadyousaf_0-1631392206574.png - These are Cards

 

TasksActual Start DateActual Completion DatePlanned Start DatePlanned Completion Date
A25/08/2005/09/2009/01/2009/07/20
B15/09/2015/02/2129/09/2011/07/21
C07/12/2015/03/2114/11/2022/01/21
D20/12/2018/04/2114/11/2022/01/21
E01/02/2111/03/2101/02/2111/03/21
F09/09/2009/02/2119/09/2028/09/20
G28/11/2003/01/2118/10/2025/11/20
H07/04/2116/05/2107/04/2110/05/21
11/04/21 11/04/2105/09/21
J17/03/2129/03/2121/04/2102/05/21
K07/06/21 18/05/2110/09/21

 

Thanks a lot. 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You may want to look into using the COALESCE function.

 

For your "actual completion date" being blank scenario it would say

 

Actual Completion = COALESCE([Actual Completion Date],TODAY())

 

meaning that if the date is missing it would be supplemented by the current date.

 

word of warning! TODAY() depends on either user interaction (if used in a measure) or frequent/daily dataset refreshes (if used in a calculated column). It is not automatic!

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You may want to look into using the COALESCE function.

 

For your "actual completion date" being blank scenario it would say

 

Actual Completion = COALESCE([Actual Completion Date],TODAY())

 

meaning that if the date is missing it would be supplemented by the current date.

 

word of warning! TODAY() depends on either user interaction (if used in a measure) or frequent/daily dataset refreshes (if used in a calculated column). It is not automatic!

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.