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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
mohammadyousaf
Resolver II
Resolver II

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.