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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jakenguyen02
Frequent Visitor

Add days to previous date to create a new start date

Hi everyone - I'm having trouble figuring this out and would appreciate the help. I have a speadsheet of audit tasks and how many days it takes to complete.  I want to generate a new start date for the next task by adding the days to complete to the original start date + 1 day. Please see the example below. 

 

Original 

jakenguyen02_0-1719416768738.png

Expected output

jakenguyen02_1-1719416808164.png

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @jakenguyen02 ,

First add a index column in Powerquery:

vcgaomsft_0-1719453746850.png

And then please create a new calculated column:

New Start Date =
VAR __index = 'Table'[Index]
VAR __start_date =
    CALCULATE (
        MAX ( 'Table'[Start Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Preparer] )
    )
VAR __days =
    CALCULATE (
        SUM ( 'Table'[Days to Complete] ),
        ALLEXCEPT ( 'Table', 'Table'[Preparer] ),
        'Table'[Index] < __index
    )
        + CALCULATE (
            COUNTROWS ( 'Table' ),
            ALLEXCEPT ( 'Table', 'Table'[Preparer] ),
            'Table'[Index] < __index
        )
VAR __result = __start_date + __days
RETURN
    __result

vcgaomsft_1-1719454539516.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

ryan_mayu
Super User
Super User

@jakenguyen02 

you can also try this to create a column

 

Column =
VAR _start=maxx(FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&not(ISBLANK('Table'[Start Date]))),'Table'[Start Date])
VAR _starttask=maxx(FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&not(ISBLANK('Table'[Start Date]))),'Table'[Task])
VAR _rows=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&'Table'[Task]<EARLIER('Table'[Task])&&'Table'[Task]>=_starttask))
VAR _days=CALCULATE(sum('Table'[Days to Complete]),FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&'Table'[Task]<EARLIER('Table'[Task])&&'Table'[Task]>=_starttask))
return if(ISBLANK('Table'[Start Date]),_start+_days+_rows,'Table'[Start Date])
 
11.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@jakenguyen02 

you can also try this to create a column

 

Column =
VAR _start=maxx(FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&not(ISBLANK('Table'[Start Date]))),'Table'[Start Date])
VAR _starttask=maxx(FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&not(ISBLANK('Table'[Start Date]))),'Table'[Task])
VAR _rows=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&'Table'[Task]<EARLIER('Table'[Task])&&'Table'[Task]>=_starttask))
VAR _days=CALCULATE(sum('Table'[Days to Complete]),FILTER('Table','Table'[Preparer]=EARLIER('Table'[Preparer])&&'Table'[Task]<EARLIER('Table'[Task])&&'Table'[Task]>=_starttask))
return if(ISBLANK('Table'[Start Date]),_start+_days+_rows,'Table'[Start Date])
 
11.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This also works perfectly. Thank you. 

Anonymous
Not applicable

Hi @jakenguyen02 ,

First add a index column in Powerquery:

vcgaomsft_0-1719453746850.png

And then please create a new calculated column:

New Start Date =
VAR __index = 'Table'[Index]
VAR __start_date =
    CALCULATE (
        MAX ( 'Table'[Start Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Preparer] )
    )
VAR __days =
    CALCULATE (
        SUM ( 'Table'[Days to Complete] ),
        ALLEXCEPT ( 'Table', 'Table'[Preparer] ),
        'Table'[Index] < __index
    )
        + CALCULATE (
            COUNTROWS ( 'Table' ),
            ALLEXCEPT ( 'Table', 'Table'[Preparer] ),
            'Table'[Index] < __index
        )
VAR __result = __start_date + __days
RETURN
    __result

vcgaomsft_1-1719454539516.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

This is perfect. Thank you!!!! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.